dicom-contour icon indicating copy to clipboard operation
dicom-contour copied to clipboard

Robustness of coords2pixel

Open 0xzz opened this issue 5 years ago • 2 comments

Hello. Nice scripts. I found this repo through your blog post.

When trying this out, I noticed that it is based on two unstated assumptions:

  1. The .dcm files are named exactly as %SOPInstanceUID%.dcm
  2. The RTStruct .dcm file is located at the same directory level as the CT Slice .dcm files.

As DICOM standards are very loose, those two assumptions aren't always correct. (I noticed this problem because it failed on my data sets...)

For example, in coords2pixel:

# extract the image id corresponding to given countour
# read that dicom file
img_ID = contour_dataset.ContourImageSequence[0].ReferencedSOPInstanceUID
img = dicom.read_file(path + img_ID + '.dcm')
img_arr = img.pixel_array

0xzz avatar Apr 09 '19 01:04 0xzz

Ditto... Any chance you could provide a way to get around having filenames that are not of the %SOPInstanceUID%.dcm format (e.g. 00000.dcm) and RTStruct is not in the same directory as slices?

akiani avatar Aug 22 '19 19:08 akiani

Thanks for pointing this out! Please feel free to do PRs :)

KeremTurgutlu avatar Aug 25 '19 15:08 KeremTurgutlu