qurit / rt-utils

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

Sign error in z coordinates of ContourData #24

Closed ThomasBudd closed 3 years ago

ThomasBudd commented 3 years ago

Dear Authors, thanks a lot for making this great library public, it is highly appreciated! We have encountered a small problem with it: we're using 3d CT images and due to the left-handed coordinate system the z coordinates in the image are negative. However the ROIs created by your library are missing the minus sign. By manually hacking I managed to get it working now, but it would be nice if this could be solved in your code. Also it would be nice if one could change the ROIGenerationAlgorithm to AUTOMATIC possibly just as an additional argument to add_roi. Many thanks! Thomas

asim-shrestha commented 3 years ago

Hi there, thank you for your kind words and for using our library! If you could, please feel free to submit a merge request for your changes and we can take a look and try to get it into the tool. We can probably incorporate your second request to the same pull request.

ThomasBudd commented 3 years ago

Hi! Many thanks for the reply. I just found out that the error is due to the SliceLocation attribute that was discussed in other issues. The scans with the z sign problem all had reversed sign in SliceLocation compated to ImagePositionPatient[2]. I can make a pull request later where just the two lines with SliceLocation are updated to ImagePositionPatient[2].

asim-shrestha commented 3 years ago

Someone was working on an update to use ImagePositionPatient already https://github.com/qurit/rt-utils/pull/26/files. Do these changes solve your problem?

I've also created a separate issue for the ROIGenerationAlgorithm if you would like to take a look https://github.com/qurit/rt-utils/issues/27 :)

ThomasBudd commented 3 years ago

Yes changing to ImagePositionPatient will solve the problem! I will have a look at the ROIGenerationAlgorithm.