CBICA / CaPTk

Cancer Imaging Phenomics Toolkit (CaPTk) is a software platform to perform image analysis and predictive modeling tasks. Documentation: https://cbica.github.io/CaPTk
https://www.cbica.upenn.edu/captk
Other
178 stars 64 forks source link

Update to 1.9.0, also Fix ROI orientation, especially 4D #1494

Closed AlexanderGetka-cbica closed 2 years ago

AlexanderGetka-cbica commented 2 years ago

Updates to 1.9.0 as well to avoid needing multiple PRs.

ROIs were failing to load properly under certain conditions due to how images get reoriented for display and the incomplete tracking of original direction. This has been fixed in this PR. Now images/ROIs get reoriented into a common orientation when loaded into the viewer and reoriented back when saved -- so the ROI/Images will now render properly when loaded into, say, ITK-snap.

Basically, this fixes ROI and image orientation so that we properly track original orientation/direction/origin at load time and go back when saving under all conditions. Before this fix, ROIs were being saved with the "correct" directionality/orientation (the same as the image that was loaded), but the actual ROI data would not be aligned with this. So you'd get odd behavior like drawing on the image, saving it and reloading it to find that it was flipped. And when this wasn't tracked properly for 4D images, we ended up with a scenario where moving the 4D slider generated a change in the mask directionality.

This also prevents a crash from occurring when trying to save 4D images, but does not yet implement it (since it's not that useful -- we don't have anything that produces new 4D images right now, anyway). It also fixes a bug where certain ImageSanityChecks would fail between otherwise valid 4D and 3D images, and where mask saving/loading would sometimes fail for 2D images.

Relevant code is in fMainWindow.cpp, SlicerManager.cpp, and cbicaITKUtilities.cpp.

AlexanderGetka-cbica commented 2 years ago

@sarthakpati The above comments are resolved. Thanks!