samplecm / dicom_to_nrrd

Simple program for converting dicom images and structure sets to nrrd files. This will create mask images of structures corresponding to an image series, and exported nrrd files can then be used for pyradiomics.
3 stars 1 forks source link

"subsegmentation" for "Chopper.py" #1

Open jimingshuo opened 1 year ago

jimingshuo commented 1 year ago

Thanks for sharing this; it is the only Python project that I can find for converting DICOM to NRRD.

I am trying to convert some data being exported from Elekta Monaco TPS, and run into some issues. I am able to fix the issues like no "Transfer Syntax UID", no "ImageOrientationPatient" tag in RTSS. But I am stuck with the call of "Chopper.organ_chopper(structures_dict[structure], subsegmentation)"

'''' Subsegmenting GTV5000 ... Traceback (most recent call last): File "C:\Medical Anatomy\MRIcroGL\dicom_to_nrrd\dicom_to_nrrd.py", line 364, in convert_all_dicoms_to_nrrd(image_dir, struct_dir, modality, save_dir) File "C:\Medical Anatomy\MRIcroGL\dicom_to_nrrd\dicom_to_nrrd.py", line 341, in convert_all_dicoms_to_nrrd Chopper.organ_chopper(structures_dict[structure], subsegmentation) File "C:\Medical Anatomy\MRIcroGL\dicom_to_nrrd\Chopper.py", line 92, in organ_chopper z_chop(contours, numCutsZ) #Make axial cuts and store in contours.segmentedContours3 File "C:\Medical Anatomy\MRIcroGL\dicom_to_nrrd\Chopper.py", line 295, in z_chop zCuts = best_cut_z(contours.whole_roi_img, numCutsZ) #Get the list of z values where structure is to be chopped File "C:\Medical Anatomy\MRIcroGL\dicom_to_nrrd\Chopper.py", line 378, in best_cut_z for i in range(1, numCuts + 1): TypeError: can only concatenate str (not "int") to str

Process finished with exit code 1 ''

'

As I don't assign a value to the "subsegmentation", I think the default value is defined as "subsegmentation=None", in the subroutine of Chopper.py, I find the value of the corresponding variable "numCuts" is the string "//". I try to force "numCuts = 0", but then there is another error of "zCuts" in "z_chop".

In my case, I don't need any "subsegmentation", may I know how I shall define the value of "subsegmentation"?

Thanks,

Matthew

p71-23 commented 3 months ago

Hi,I hope you're doing well. I was wondering if you managed to solve this issue? I'm encountering the exact same problem and would greatly appreciate any insights you could share.

jimingshuo commented 3 months ago

Hi There, I did not get any suggestion on that issue either in the end, and I did not explore this solution anymore.