-
Notifications
You must be signed in to change notification settings - Fork 458
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
BUG: Fix vtkITKArchetypeImageSeriesReader::CanReadFile() #1269
Conversation
Makes sense to me. Was there a specific issue that requires this change? (I.e. wouldn't it just have failed later?). |
It was causing some failing tests in SlicerRT. vtkMRMLSegmentationStorageNode would try to load polydata as an image and report an error. Everything still loaded fine, but the error messages caused the test to fail. Probably there is some other way to work around the error messages, but I figured that the the better approach would be to determine if vtkITKArchetypeImageSeriesReader can actually read the file before attempting to use it. |
Yes, makes sense. Fine to merge from my point of view. |
I wonder if there is anyway to refactor the code used in both |
Yes, all that code is pretty messy. Could make sense to take a fresh pass at the whole class. |
This could be done later of course and I would have no issue integrated this patch, just wanted to point it out. @Sunderlandkyl I will let you assess. |
I agree, it makes sense to reduce the code duplication. |
🙏 |
d842edd
to
80dd2cf
Compare
I've added a GetImageIO function that is used by both RequestInformation and CanReadFile. |
vtkITKArchetypeImageSeriesReader::CanReadFile previously returned true as long as the Archetype was set, and the file exists. Now, CanReadFile will return true if an itk::ImageFileReader can be instantiated for the specified file.
80dd2cf
to
e1d4903
Compare
The title of this PR is still "do not integrate" - can you confirm that it can be integrated now? Thank you! |
@lassoan It should be ready to integrate. |
Thanks a lot, everyone! I integrated it (Slicer/Slicer@8ea6945) so that we can see in the next nightly if the SlicerRT tests pass, to make progress with this PR. |
vtkITKArchetypeImageSeriesReader::CanReadFile previously returned true as long as the Archetype was set, and the file exists.
Now, CanReadFile will return true if, in addition to the archetype being set and the file existing, an itk::ImageFileReader can be instantiated for the specified file.