Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DICOM importer does not check for missing slices / inconsistent slice spacing #7

Open
jmsmkn opened this issue Mar 8, 2021 · 6 comments

Comments

@jmsmkn
Copy link
Member

jmsmkn commented Mar 8, 2021

See comic/grand-challenge.org#1301

@nlessmann
Copy link
Contributor

This would be a very useful feature since inconsistent slice spacing is quite prevalent in some of our datasets.

The DICOM standard supports this but the formats that we actually work with do not - so in my opinion, the solution should be to use all of the present data to interpolate the data onto a regular grid with the most common spacing.

@pkcakeout
Copy link
Member

The DICOM standard supports this but the formats that we actually work with do not

Spoken like a true CT-centrist ;-) We also support MR on grand-challenge now and inconsistent slice spacings are way more common for MR than for CT if I am not mistaken. So it still needs to be considered, as I wrote in my in the original issue.

It is also fine to reject those, but we then need to specify what is actually supported.

@cjacobs1
Copy link
Member

I would argue that an import error should be produced, reporting back that no single volumetric dataset could be created from the set of DICOM files. I think we should not interpolate data by default.

@cjacobs1
Copy link
Member

cjacobs1 commented Nov 15, 2022

I have prepared some test data for this. It can be found here: \\umcsanfsclp01.umcn.nl\radng_diag\rse\projects\rse-panimg\testdata

@jmsmkn
Copy link
Member Author

jmsmkn commented Nov 16, 2022

The spacing is determined here, you should be able to raise any exception and it be passed along and the study will be rejected:

# Multiple slices, average spacing between slices
avg_origin_diff = origin_diff / n_diffs
z_i = np.linalg.norm(avg_origin_diff)
# Use orientation of the coordinate system to determine in which
# direction the origins of the individual slices should move.
# Use the dot product to find the angle between that direction
# and the spacing vector - this tells us whether the order of
# the slices is correct or should be reversed
z_direction = self.direction @ np.ones(self.dimensions)
if self.dimensions > 3:
avg_origin_diff = np.pad(
avg_origin_diff,
pad_width=(0, self.dimensions - avg_origin_diff.size),
mode="constant",
)
z_order = np.sign(np.dot(avg_origin_diff, z_direction))

@cjacobs1
Copy link
Member

Thanks, I'll work on a fix and prepare a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants