-
Notifications
You must be signed in to change notification settings - Fork 481
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
Add checks to ensure image and label correspondence #18
Comments
good idea! @naucoin worked on this kind of checks in Slicer core, so we can just reuse here |
Re 2) and 4), I don't think this should be checked - label can paint a sub-volume of the input image. We can check if the label image is a sub-volume of the input image. |
True, they may be of different dimensions - I don't see it being a problem if they are properly registered. Just a reminder, the whole image and whole label are independently resampled (i.e. to 3x3x3 with some interpolation function) and THEN cropped to a prism with the dimensions of the tumor label. Also, I think sub-volume inputs are a minority case (and maybe should not be encouraged?). |
I can't think of a way to automatically check if they are properly registered. If you have ideas, please propose!
I don't see this done in pyradiomics.
I agree, they should not. The question is different though: should they be prohibited (this is what is implied by your original suggestion). |
I'm not sure about automatic registration checks - though, I think I will update the cropping function to use SimpleITK cropping filters (which would account for the image orientation/origin) rather than the (naive) array index matching cropping function that we currently have. The sitk-based resampling function is in preprocessing.py. The interpolation function differs from the baseline's function so we don't have a testing strategy...yet. The cropping function is already implemented and used, but assumes that the image and label have the same dimensions. We don't have to prohibit sub-volumes for now, but we can at least check and log a warning to the user. |
Yes, but my point is that it is not used, if you look in the base class or individual feature classes. We pass resampling to the feature classes, so probably interpolation and cropping should be done in the base class. It probably also makes sense to do padding in the base class, instead of repeating it in each of the individual feature classes. |
@naucoin does it make sense to reuse the geometry checks from Slicer for this purpose? |
@fedorov The checks in Slicer rely on the volumes being inside of volume nodes with vtkImageData, for pure image arrays I'd have to rewrite them. |
Check in simple ITK for quick geometry mismatch comparisons (spacing, orientation, origin not as important (as long as overlap?)) |
related functionality in ITK: https://itk.org/Doxygen/html/classitk_1_1ImageToImageFilter.html#acc8f8667757385e7b607650620c58616 |
Currently, origin, spacing and direction are checked by simple ITK functionality in So as long as resampling is enabled, both are forced to the same space. Still it may be an idea to calculate the size/location of the resamplegrid completely on the labelmap (currently, bounding box is extracted from labelmap, but spacing, origin, direction, etc. is extracted from image). This would ensure the correct area is resampled in case the labelmap is but a slingle slice. If resampling is disabled and the geometry is different, the package will throw an error due to the check that is applied during cropping. |
The idea was to throw error in the constructor during initialization if there is a mismatch in spacing and directions. |
In that case, I think it is easiest to add a check in |
I would add the check to the base class, since as we discussed before, |
@fedorov It's true that |
The difference is that this check would be a very lightweight operation, just few comparisons, unlike resampling and cropping. We could also just add it to |
True, but does not handle the other part, namely that preprocessing is done prior to the image being passed to the featureclass. Upon implementation in |
I see your point. I think it would be good to have that check function standalone in |
In #223, I added some checks (including thoses suggested here). The checks described here are applied by SimpleITK when the bounding box is calculated using the In addition to these checks, also checks some size constraints (can't extract features from a single voxel). 2 points with these checks:
|
What would be possible is to use the same |
resolved by #223 |
Add checks (in base class?):
The text was updated successfully, but these errors were encountered: