I have written a code that is used to pull DICOM files from my internal server, but I am having difficulty running it repeatedly for different accession numbers.
Summary of the workflow: Given a certain accession number,
- use findscu to get information on the accession number,
- parse the output file to a dataframe to organize the information,
- Choose specific series descriptions from the data frame,
- use movescu to download the scans
- Perform processing on the downloaded DICOM scan
Then repeat for a new accession number.
The problem occurs when executing findscu the second time, it will tell me that there is no acccession number information on the database as if the accession number doesn't exist. But this is not possible, because when I stop the code and iterate manually the next accession number does exist on the database.
findscu command:
'findscu -v -S -k 0008,0052=SERIES -k 0010,0010="" -k 0010,0020="" -k 0008,0050=<acc_num> -k 0008,1030="" -k 0020,000D="" -k 0008,0020="" -k 0008,103e="" -k 0020,0011="" -k 0020,000E="" -k 0020,1002="" -aet <my_aet> -aec <remote_aet> <remote_ip> <remote_port> > F:\\FGTCategoryQuantification_mhas\\findscu_acc_num_SERIES.txt'
movescu command:
'movescu -S +P 4006 -k 0008,0052=IMAGE -k 0010,0010="" -k 0010,0020="" -k 0008,0050=<acc_num> -k 0008,1030="" -k 0020,000D=1.2.826.0.1.3680043.2.1009.1465932691.20300.142.76.30.2008137300 -k 0008,0020="" -k 0008,103e="" -k 0020,0011="" -k 0020,000E=1.2.826.0.1.3680043.2.1009.1465932803.545000130.20070116 -k 0020,1002="" -aet <my_Aet> -aec <remote_aet> <remote_ip> <remote_port> -od F:\\FGTCategoryQuantification_mhas\\DICOMacc_numX01 > F:\\FGTCategoryQuantification_mhas\\DICOMacc_numX01\\movescu_acc_numPh1SagVIBRANTMPH.txt'
I am thinking that there is some connection possibly open still that interupts the second findscu execution? or some other problem? I don't have a lot of experience with dcmtlk. Any advice would be much appreciated.
Thank you in advance - Grey