qurit / rt-utils

A minimal Python library to facilitate the creation and manipulation of DICOM RTStructs.
MIT License
191 stars 56 forks source link

suggestion to avoid issue when multiple types of files are in the same folder #51

Open EmmaSkarsoe opened 2 years ago

EmmaSkarsoe commented 2 years ago

Hi rt_Utils authors,

Thanks for a great tool !

I've experienced some problems, when I am running the add_roi function. I got the following error-message: Mask must have the same number of layers (In the 3rd dimension) as input series. Expected 130, got 129.

The problem arises, because my folder contains both RT structs, CT scans, RT dose and RT plan. The RT dose file do also have a 'pixel_array' attribute.

I changed a line in the function: _load_dcm_images_frompath

from _if hasattr(ds, "pixel_array"): seriesdata.append(ds) to _if ds.Modality == 'CT': seriesdata.append(ds)

It solved my problem. :)

mathiser commented 2 years ago

This is a really good idea! Perhaps instead of hardcoding it to "CT", there could be an option which defaults to CT, but is changable to other modalities. It could even be set with SOPClassUID to avoid overlapping uses of Modality?

asim-shrestha commented 1 year ago

Thanks for reaching out @EmmaSkarsoe, and good call @mathiser. I'm not sure when I can work on that but that seems like a good solution.

mathiser commented 1 year ago

Dear @asim-shrestha It's so great there is some activity on the repo again!

Are you open to pull requests?

asim-shrestha commented 1 year ago

Yes of course! Please feel free to submit any of your desired changes :)