bhklab / readii

Radiomic Extraction and Analysis for DICOM Images (READII)
MIT License
3 stars 0 forks source link

`read_dicom_auto` can return any one of `(Scan | PET | StructureSet | Dose | Segmentation | None)` #32

Open strixy16 opened 3 weeks ago

strixy16 commented 3 weeks ago
          `read_dicom_auto` can return any one of `(Scan | PET | StructureSet | Dose | Segmentation | None)`

for baseImage I'm assuming it should must return a Scan type? reason:

the baseImage.image will only work if baseImage is of type Scan, and we can provide better logging/error handling

segMasks = makeMask(
    segImage,
    baseImage.image,
    existing_roi_indices={"background": 0},
    ignore_missing_regex=False,
)

if so, should verify this type before proceeding with something like:

from imgtools.modules import scan
...
baseImage = read_dicom_auto(baseImageDirPath)
assert isinstance(baseImage, scan.Scan), f"baseImage is not a Scan object. has type {type(baseImage)}"

or something

_Originally posted by @jjjermiah in https://github.com/bhklab/readii/pull/31#discussion_r1722185902_

strixy16 commented 3 weeks ago

Should update to read_dicom_scan as this step is meant to load CT or MR and that's the specific function for that.