diff --git a/CMakeLists.txt b/CMakeLists.txt index 32e405b4e..87501e673 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ SET( ${PROJECT_NAME}_Variant "Full" ) # the particular variant of CaPTk (Full/Ne SET( PROJECT_VERSION_MAJOR 1 ) SET( PROJECT_VERSION_MINOR 9 ) -SET( PROJECT_VERSION_PATCH 0.RC ) +SET( PROJECT_VERSION_PATCH 0 ) SET( PROJECT_VERSION_TWEAK ) # check for the string "nonRelease" in the PROJECT_VERSION_PATCH variable diff --git a/Readme.md b/Readme.md index d48243e8e..7a181c6e9 100644 --- a/Readme.md +++ b/Readme.md @@ -37,14 +37,13 @@ This work is in part supported by the grant U24-CA189523, awarded by the Nationa By downloading CaPTk, you agree to our [License](./LICENSE). You can review Installation Instructions [here](https://cbica.github.io/CaPTk/Installation.html). -## Latest Stable (1.8.1) +## Latest Stable (1.9.0) | Platform (x64) | Link | |:--------------:|:------------------------------------------------:| -| Windows | https://www.nitrc.org/frs/downloadlink.php/11777 | -| Linux | https://www.nitrc.org/frs/downloadlink.php/11778 | -| Linux (CentOS7)| https://www.nitrc.org/frs/downloadlink.php/11779 | -| macOS | https://www.nitrc.org/frs/downloadlink.php/11780 | +| Windows | https://www.nitrc.org/frs/downloadlink.php/12727 | +| Linux | https://www.nitrc.org/frs/downloadlink.php/12726 | + ## Development Builds diff --git a/docs/1_credits.html b/docs/1_credits.html index 086a9b0cb..83079519c 100644 --- a/docs/1_credits.html +++ b/docs/1_credits.html @@ -12,7 +12,7 @@

- Cancer Imaging Phenomics Toolkit (CaPTk) v.1.9.0.RC  | Contact: software@cbica.upenn.edu + Cancer Imaging Phenomics Toolkit (CaPTk) v.1.9.0  | Contact: software@cbica.upenn.edu
Disclaimer: CaPTk has been designed for non-commercial research purposes only and has not been reviewed or approved by the Food and Drug Administration (FDA). It is not intended or recommended for clinical application.
diff --git a/docs/BraTS_Metrics.html b/docs/BraTS_Metrics.html index c6f557e60..fa613d9e8 100644 --- a/docs/BraTS_Metrics.html +++ b/docs/BraTS_Metrics.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/BreastCancer_LIBRA.html b/docs/BreastCancer_LIBRA.html index 33d58e57a..13833544f 100644 --- a/docs/BreastCancer_LIBRA.html +++ b/docs/BreastCancer_LIBRA.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/BreastCancer_breastSegmentation.html b/docs/BreastCancer_breastSegmentation.html index 88e8b7622..a1204b9ec 100644 --- a/docs/BreastCancer_breastSegmentation.html +++ b/docs/BreastCancer_breastSegmentation.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/BreastCancer_texture.html b/docs/BreastCancer_texture.html index 50c212d9b..025e5928e 100644 --- a/docs/BreastCancer_texture.html +++ b/docs/BreastCancer_texture.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Diffusion_Derivatives.html b/docs/Diffusion_Derivatives.html index bb1336d8d..09396d439 100644 --- a/docs/Diffusion_Derivatives.html +++ b/docs/Diffusion_Derivatives.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Download.html b/docs/Download.html index 238326760..085a0c7f6 100644 --- a/docs/Download.html +++ b/docs/Download.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/FAQ.html b/docs/FAQ.html index 2c59bf804..1d9d112ed 100644 --- a/docs/FAQ.html +++ b/docs/FAQ.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Getting_Started.html b/docs/Getting_Started.html index 7a4e373c7..4312f9d7f 100644 --- a/docs/Getting_Started.html +++ b/docs/Getting_Started.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Glioblastoma_Atlas.html b/docs/Glioblastoma_Atlas.html index bd1d6ad1b..c784cee1e 100644 --- a/docs/Glioblastoma_Atlas.html +++ b/docs/Glioblastoma_Atlas.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Glioblastoma_Confetti.html b/docs/Glioblastoma_Confetti.html index 4c9dbae04..a9565733a 100644 --- a/docs/Glioblastoma_Confetti.html +++ b/docs/Glioblastoma_Confetti.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Glioblastoma_Directionality.html b/docs/Glioblastoma_Directionality.html index c025beafd..ae0b7e008 100644 --- a/docs/Glioblastoma_Directionality.html +++ b/docs/Glioblastoma_Directionality.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Glioblastoma_EGFRvIII.html b/docs/Glioblastoma_EGFRvIII.html index c61054a6f..a79417a49 100644 --- a/docs/Glioblastoma_EGFRvIII.html +++ b/docs/Glioblastoma_EGFRvIII.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Glioblastoma_PHI.html b/docs/Glioblastoma_PHI.html index 66bd4bc27..9b7b69175 100644 --- a/docs/Glioblastoma_PHI.html +++ b/docs/Glioblastoma_PHI.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Glioblastoma_Pseudoprogression.html b/docs/Glioblastoma_Pseudoprogression.html index e8b40fe63..ee86844b4 100644 --- a/docs/Glioblastoma_Pseudoprogression.html +++ b/docs/Glioblastoma_Pseudoprogression.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Glioblastoma_Recurrence.html b/docs/Glioblastoma_Recurrence.html index a509adf98..8871995ce 100644 --- a/docs/Glioblastoma_Recurrence.html +++ b/docs/Glioblastoma_Recurrence.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Glioblastoma_Survival.html b/docs/Glioblastoma_Survival.html index 8b66688d8..2bd1a05de 100644 --- a/docs/Glioblastoma_Survival.html +++ b/docs/Glioblastoma_Survival.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Glioblastoma_WhiteStripe.html b/docs/Glioblastoma_WhiteStripe.html index 727d82358..c5bf0e7e9 100644 --- a/docs/Glioblastoma_WhiteStripe.html +++ b/docs/Glioblastoma_WhiteStripe.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/How_To_Guides.html b/docs/How_To_Guides.html index 3d0224ade..cdae2756e 100644 --- a/docs/How_To_Guides.html +++ b/docs/How_To_Guides.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/ITCR_Connectivity.html b/docs/ITCR_Connectivity.html index 15d1c9393..f6eebcf9c 100644 --- a/docs/ITCR_Connectivity.html +++ b/docs/ITCR_Connectivity.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Installation.html b/docs/Installation.html index 1431809df..136f4b57e 100644 --- a/docs/Installation.html +++ b/docs/Installation.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/LungCancer_SBRT.html b/docs/LungCancer_SBRT.html index bab218c5d..67157568b 100644 --- a/docs/LungCancer_SBRT.html +++ b/docs/LungCancer_SBRT.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/PCA_Extraction.html b/docs/PCA_Extraction.html index 74fc79929..286e23609 100644 --- a/docs/PCA_Extraction.html +++ b/docs/PCA_Extraction.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/People.html b/docs/People.html index 96ab2bfb5..49e165b1c 100644 --- a/docs/People.html +++ b/docs/People.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Perfusion_Alignment.html b/docs/Perfusion_Alignment.html index 2b0415bdd..726cd9434 100644 --- a/docs/Perfusion_Alignment.html +++ b/docs/Perfusion_Alignment.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Perfusion_Derivatives.html b/docs/Perfusion_Derivatives.html index 7e08f11c8..3e019c949 100644 --- a/docs/Perfusion_Derivatives.html +++ b/docs/Perfusion_Derivatives.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/ReleaseNotes.html b/docs/ReleaseNotes.html index 68d3667ec..aa08ca074 100644 --- a/docs/ReleaseNotes.html +++ b/docs/ReleaseNotes.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Science.html b/docs/Science.html index 2a70cf9d2..efa6af3f8 100644 --- a/docs/Science.html +++ b/docs/Science.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Technical_Reference.html b/docs/Technical_Reference.html index 42bba2382..12a27ef48 100644 --- a/docs/Technical_Reference.html +++ b/docs/Technical_Reference.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/Training_Module.html b/docs/Training_Module.html index 7ae84e662..115247749 100644 --- a/docs/Training_Module.html +++ b/docs/Training_Module.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/ht_FeatureExtraction.html b/docs/ht_FeatureExtraction.html index c2a4d5ed2..5962eb40d 100644 --- a/docs/ht_FeatureExtraction.html +++ b/docs/ht_FeatureExtraction.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/ht_Preprocessing.html b/docs/ht_Preprocessing.html index c0794acd7..840b3293c 100644 --- a/docs/ht_Preprocessing.html +++ b/docs/ht_Preprocessing.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/ht_Segmentation.html b/docs/ht_Segmentation.html index 72b7a4337..d1cbc3f1e 100644 --- a/docs/ht_Segmentation.html +++ b/docs/ht_Segmentation.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/ht_SpecialApps.html b/docs/ht_SpecialApps.html index 89a66f600..cf80084b6 100644 --- a/docs/ht_SpecialApps.html +++ b/docs/ht_SpecialApps.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/ht_utilities.html b/docs/ht_utilities.html index 9421469a7..f6fcbd4a2 100644 --- a/docs/ht_utilities.html +++ b/docs/ht_utilities.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/index.html b/docs/index.html index 86d289f3b..01608f1b6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/index.qhp b/docs/index.qhp index e5fb2003e..9f1c795ae 100644 --- a/docs/index.qhp +++ b/docs/index.qhp @@ -5,7 +5,7 @@ doxygen -
+
diff --git a/docs/pages.html b/docs/pages.html index b49bdfa89..8381f268f 100644 --- a/docs/pages.html +++ b/docs/pages.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/preprocessing_bias.html b/docs/preprocessing_bias.html index 647a4cf3d..8d42030ba 100644 --- a/docs/preprocessing_bias.html +++ b/docs/preprocessing_bias.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/preprocessing_brats.html b/docs/preprocessing_brats.html index 7efe2bea4..3a165dffa 100644 --- a/docs/preprocessing_brats.html +++ b/docs/preprocessing_brats.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/preprocessing_dcm2nii.html b/docs/preprocessing_dcm2nii.html index ae1b28a56..a7085606d 100644 --- a/docs/preprocessing_dcm2nii.html +++ b/docs/preprocessing_dcm2nii.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/preprocessing_histoMatch.html b/docs/preprocessing_histoMatch.html index f0baf99be..f9cf6510a 100644 --- a/docs/preprocessing_histoMatch.html +++ b/docs/preprocessing_histoMatch.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/preprocessing_reg.html b/docs/preprocessing_reg.html index c0a6ae58b..d11f2ce1b 100644 --- a/docs/preprocessing_reg.html +++ b/docs/preprocessing_reg.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/preprocessing_susan.html b/docs/preprocessing_susan.html index 4581d0065..f7b60cd2a 100644 --- a/docs/preprocessing_susan.html +++ b/docs/preprocessing_susan.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/preprocessing_zScoreNorm.html b/docs/preprocessing_zScoreNorm.html index 4b3de1ae7..b8cbc785f 100644 --- a/docs/preprocessing_zScoreNorm.html +++ b/docs/preprocessing_zScoreNorm.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/seg_DL.html b/docs/seg_DL.html index b988af85f..42f197457 100644 --- a/docs/seg_DL.html +++ b/docs/seg_DL.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/seg_GeoTrain.html b/docs/seg_GeoTrain.html index 89735c8a6..c30276c7e 100644 --- a/docs/seg_GeoTrain.html +++ b/docs/seg_GeoTrain.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/seg_Geodesic.html b/docs/seg_Geodesic.html index 915057468..209f3f1d1 100644 --- a/docs/seg_Geodesic.html +++ b/docs/seg_Geodesic.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/seg_SNAP.html b/docs/seg_SNAP.html index 982a71c19..b849e8675 100644 --- a/docs/seg_SNAP.html +++ b/docs/seg_SNAP.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/tr_FeatureExtraction.html b/docs/tr_FeatureExtraction.html index 5e9943f6a..4ef19fa89 100644 --- a/docs/tr_FeatureExtraction.html +++ b/docs/tr_FeatureExtraction.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/docs/tr_integration.html b/docs/tr_integration.html index 27eeefb1e..f0f81a151 100644 --- a/docs/tr_integration.html +++ b/docs/tr_integration.html @@ -30,7 +30,7 @@
Cancer Imaging Phenomics Toolkit (CaPTk) -  1.9.0.RC +  1.9.0
diff --git a/src/cbica_toolkit/src/cbicaITKSafeImageIO.h b/src/cbica_toolkit/src/cbicaITKSafeImageIO.h index 4957d234f..02542fb46 100644 --- a/src/cbica_toolkit/src/cbicaITKSafeImageIO.h +++ b/src/cbica_toolkit/src/cbicaITKSafeImageIO.h @@ -435,6 +435,7 @@ namespace cbica template void WriteImage(typename ComputedImageType::Pointer imageToWrite, const std::string &fileName) { + // TODO: Enable 4D image saving //// check write access //if (((_access(fileName.c_str(), 2)) == -1) || ((_access(fileName.c_str(), 6)) == -1)) //{ diff --git a/src/cbica_toolkit/src/cbicaITKUtilities.h b/src/cbica_toolkit/src/cbicaITKUtilities.h index 01e4176f7..65fb3c564 100644 --- a/src/cbica_toolkit/src/cbicaITKUtilities.h +++ b/src/cbica_toolkit/src/cbicaITKUtilities.h @@ -542,7 +542,7 @@ namespace cbica auto imageOrigin2 = imageInfo2.GetImageOrigins(); auto imageDirs1 = imageInfo1.GetImageDirections(); - auto imageDirs2 = imageInfo1.GetImageDirections(); + auto imageDirs2 = imageInfo2.GetImageDirections(); for (size_t d = 0; d < dims; d++) { @@ -572,14 +572,15 @@ namespace cbica return false; } - if (imageDirs1[d].size() != imageDirs2[d].size()) + if ( (imageDirs1[d].size() != imageDirs2[d].size()) && !FourDImageCheck ) { + // Handle mis-matched dir sizes (generally indicates mismatch in dims) std::cout << "The direction in dimension[" << d << "] of the image_1 (" << image1 << ") and image_2 (" << image2 << ") doesn't match.\n"; return false; } else { - for (size_t i = 0; i < imageDirs1[d].size(); i++) + for (size_t i = 0; i < dims; i++) // Dirs are NxN where N is dimensionality. We need to handle 4D vs 3D { if (imageDirs1[d][i] != imageDirs2[d][i]) { diff --git a/src/view/gui/SlicerManager.cpp b/src/view/gui/SlicerManager.cpp index 959afa324..30dc7b011 100644 --- a/src/view/gui/SlicerManager.cpp +++ b/src/view/gui/SlicerManager.cpp @@ -34,6 +34,7 @@ See COPYING file or https://www.med.upenn.edu/cbica/software-agreement.html #include #include "cbicaITKImageInfo.h" +#include "cbicaITKUtilities.h" #include "CaPTkEnums.h" SlicerManager::SlicerManager(int numberOfSlicers, Landmarks* landmarks, Landmarks* seedPoints, Landmarks* tissuePoints) @@ -135,13 +136,17 @@ void SlicerManager::SetPerfImage(ImageTypeFloat4D::Pointer image) FilterType::Pointer filter = FilterType::New(); filter->SetExtractionRegion(desiredRegion); filter->SetInput(mPerfusionImagePointer); - - filter->SetDirectionCollapseToIdentity(); // This is required. + filter->SetDirectionCollapseToSubmatrix(); // This is required. filter->Update(); - mITKImage = filter->GetOutput(); + mITKImage = cbica::GetImageOrientation(filter->GetOutput(),"RAI").second; UpdateVtkImage(); } +ImageTypeFloat4D::Pointer SlicerManager::GetPerfImage() +{ + return mPerfusionImagePointer; +} + void SlicerManager::SetOriginalOrigin(ImageTypeFloat3D::PointType origin) { std::vector< double > actualOriginVector; @@ -1257,7 +1262,7 @@ void SlicerManager::Get3DImageAtCurrentPerfusionIndex(int sliderindex) croppingFilter->SetExtractionRegion(regionToCrop); croppingFilter->SetDirectionCollapseToSubmatrix(); // This is required. croppingFilter->Update(); - mITKImage->Graft(croppingFilter->GetOutput());//TBD this is crashing + mITKImage->Graft(cbica::GetImageOrientation(croppingFilter->GetOutput(), "RAI").second); UpdateVtkImage(); this->Render(); diff --git a/src/view/gui/SlicerManager.h b/src/view/gui/SlicerManager.h index 013d6549e..9bcf75032 100644 --- a/src/view/gui/SlicerManager.h +++ b/src/view/gui/SlicerManager.h @@ -106,6 +106,10 @@ class SlicerManager : public QObject //! Set new 4D image void SetPerfImage(ImageTypeFloat4D::Pointer image); + //! Get the loaded 4D image + ImageTypeFloat4D::Pointer GetPerfImage(); + + //! Set the vtk mask void SetMask(vtkSmartPointer< vtkImageData > mask); diff --git a/src/view/gui/fMainWindow.cpp b/src/view/gui/fMainWindow.cpp index 8647e33eb..39dfafa31 100644 --- a/src/view/gui/fMainWindow.cpp +++ b/src/view/gui/fMainWindow.cpp @@ -1318,6 +1318,11 @@ void fMainWindow::SaveImage_withFile(int indexOfInputImageToWrite, QString saveF cbica::WriteImage< ImageTypeFloat3D >(infoChanger->GetOutput(), correctExtension(saveFileName_string)); } + else if (cbica::ImageInfo(mSlicerManagers[index]->GetPathFileName()).GetImageDimensions() == 4) + { + cbica::WriteImage< ImageTypeFloat4D >(mSlicerManagers[index]->GetPerfImage(), correctExtension(saveFileName_string)); + updateProgress(0, "Image saved! (" + saveFileName_string + ")"); + } else { auto img = reorientedImage.second; @@ -1490,6 +1495,7 @@ void fMainWindow::SaveImage() { return; } + // QString saveFileName = getSaveFile(this, mInputPathName, mInputPathName + "_new.nii.gz"); SaveImage_withFile(index, saveFileName); @@ -1729,7 +1735,7 @@ void fMainWindow::LoadSlicerImages(const std::string &fileName, const int &image { fname = ConversionFrom2Dto3D(fname); } - else if (!bFirstLoad) + if (!bFirstLoad) { { //auto temp_prev = cbica::normPath(m_tempFolderLocation + "/temp_prev.nii.gz"); @@ -1828,6 +1834,42 @@ void fMainWindow::LoadSlicerImages(const std::string &fileName, const int &image imageManager->mImageSubType = CAPTK::ImageModalityType::IMAGE_TYPE_PERFUSION; imageManager->SetOriginalOrigin(imageInfo.GetImageOrigins()); // Fix missing (3D) origins for 4D + auto original4DDirection = imagePerf->GetDirection(); + // Construct acceptable 3D directions from existing 4D directions + using DirectionType3D = itk::Matrix; + DirectionType3D directionIn3D; + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + directionIn3D(i, j) = (double)original4DDirection(i, j); + } + } + + imageManager->SetOriginalDirection(directionIn3D); + // Now get the original image orientation from the 3D float read + using ExtractorType = itk::ExtractImageFilter; + auto extractor = ExtractorType::New(); + extractor->SetInput(imagePerf); + extractor->SetDirectionCollapseToSubmatrix(); // Needed to preserve original directionality for this read + ImageTypeFloat4D::RegionType region = imagePerf->GetLargestPossibleRegion(); + ImageTypeFloat4D::IndexType regionIndex; + ImageTypeFloat4D::SizeType regionSize; + regionSize[0] = region.GetSize()[0]; + regionSize[1] = region.GetSize()[1]; + regionSize[2] = region.GetSize()[2]; + regionSize[3] = 0; + regionIndex[0] = 0; + regionIndex[1] = 0; + regionIndex[2] = 0; + regionIndex[3] = 0; + ImageTypeFloat4D::RegionType desiredRegion(regionIndex, regionSize); + extractor->SetExtractionRegion(desiredRegion); + extractor->Update(); + auto subImage = extractor->GetOutput(); + auto tempImage = cbica::GetImageOrientation< ImageTypeFloat3D >(subImage, "RAI"); // defaults to RAI + // And bypass the issues with 4D template specialization of the above + imageManager->SetOriginalOrientation(tempImage.first); imageManager->SetPerfImage(imagePerf); } else @@ -1836,7 +1878,7 @@ void fMainWindow::LoadSlicerImages(const std::string &fileName, const int &image auto currentImage = cbica::ReadImage(fname); imageManager->SetOriginalDirection(currentImage->GetDirection()); imageManager->SetOriginalOrigin(currentImage->GetOrigin()); - auto tempImage = cbica::GetImageOrientation< ImageTypeFloat3D >(cbica::ReadImage< ImageTypeFloat3D >(fname)); // defaults to RAI + auto tempImage = cbica::GetImageOrientation< ImageTypeFloat3D >(cbica::ReadImage< ImageTypeFloat3D >(fname), "RAI"); // defaults to RAI imageManager->SetOriginalOrientation(tempImage.first); currentImage = ChangeImageDirectionToIdentity< ImageTypeFloat3D >(tempImage.second); imageManager->SetImage(currentImage); @@ -3019,6 +3061,13 @@ void fMainWindow::SaveDrawing() imageToWrite->DisconnectPipeline(); if (mSlicerManagers[index]->mImageSubType != CAPTK::ImageModalityType::IMAGE_TYPE_PERFUSION) { + imageToWrite->DisconnectPipeline(); + + auto originalOrientation = mSlicerManagers[index]->mOrientation; + + // This was originally restricted to only non-4D/perfusion cases, + // but we can actually handle this case regardless (3D mask is assumed even for 4D cases). + // In fact, we have to in order to restore original orientation. ImageTypeMask::DirectionType originalDirection; originalDirection[0][0] = mSlicerManagers[index]->mDirection(0, 0); originalDirection[0][1] = mSlicerManagers[index]->mDirection(0, 1); @@ -3033,6 +3082,9 @@ void fMainWindow::SaveDrawing() ImageTypeMask::PointType originalOrigin; originalOrigin = mSlicerManagers[index]->mOrigin; + auto reorientedImage = cbica::GetImageOrientation< ImageTypeMask >(imageToWrite, originalOrientation); + auto imageToWrite_wrap = reorientedImage.second; + auto infoChanger = itk::ChangeInformationImageFilter< ImageTypeMask >::New(); infoChanger->SetInput(imageToWrite); infoChanger->ChangeDirectionOn(); @@ -3340,14 +3392,16 @@ void fMainWindow::readMaskFile(const std::string &maskFileName) imageSanityCheckDone = true; } } - //auto temp_prev = cbica::normPath(m_tempFolderLocation + "/temp_prev.nii.gz"); + + // Needs to be done with OrientFix so that it matches the in-memory ITK image (which should always be RAI/Identity direction). auto mask_temp = cbica::ReadImageWithOrientFix< ImageTypeFloat3D >(maskFileName_toRead); - // Added this to allow masks of non-identity direction to pass the image sanity check below. - mask_temp = ChangeImageDirectionToIdentity< ImageTypeFloat3D >(mask_temp); - //SaveImage_withFile(0, temp_prev.c_str()); + + + auto baseFirstImage = mSlicerManagers[0]->mITKImage; if (!imageSanityCheckDone) { - if (!cbica::ImageSanityCheck< ImageTypeFloat3D >(mSlicerManagers[0]->mITKImage, mask_temp)) + bool fourDImage = (mSlicerManagers[0]->GetDimension() == 4); + if (!cbica::ImageSanityCheck(baseFirstImage, mask_temp, fourDImage)) { ShowErrorMessage("The physical dimensions of the previously loaded image and the mask are inconsistent; proceeding to open registration dialog"); ImageRegistration(); @@ -3357,7 +3411,9 @@ void fMainWindow::readMaskFile(const std::string &maskFileName) } using ImageType = itk::Image; auto inputImage = cbica::ReadImageWithOrientFix< ImageType >(maskFileName_toRead); - inputImage = ChangeImageDirectionToIdentity< ImageType >(inputImage); + + // The below commented code ONLY changes direction information and does NOT re-orient the image. Be careful! + //inputImage = ChangeImageDirectionToIdentity< ImageType >(inputImage); auto minMaxCalc = itk::MinimumMaximumImageCalculator< ImageType >::New(); minMaxCalc->SetImage(inputImage);