From 7a79cb44161cff50a1358c33469be07075631274 Mon Sep 17 00:00:00 2001 From: Julieta Mateos Date: Thu, 12 Dec 2024 19:18:28 -0500 Subject: [PATCH 1/8] Changes in file --- Core/Kernel/elxElastixBase.cxx | 23 ++++++ Core/Kernel/elxElastixBase.h | 11 +++ Core/Kernel/elxElastixMain.cxx | 40 ++++++++++- Core/Kernel/elxElastixMain.h | 17 +++++ Core/Kernel/elxElastixTemplate.h | 10 +++ Core/Kernel/elxElastixTemplate.hxx | 18 +++++ Core/Main/itkElastixRegistrationMethod.h | 28 ++++++++ Core/Main/itkElastixRegistrationMethod.hxx | 84 ++++++++++++++++++++++ 8 files changed, 229 insertions(+), 2 deletions(-) diff --git a/Core/Kernel/elxElastixBase.cxx b/Core/Kernel/elxElastixBase.cxx index e76f7005e..a25467c28 100644 --- a/Core/Kernel/elxElastixBase.cxx +++ b/Core/Kernel/elxElastixBase.cxx @@ -506,5 +506,28 @@ ElastixBase::GetNumberOfTransformConfigurations() const return m_TransformConfigurations.size(); } +void +ElastixBase::SetFixedWeightedMask(const MaskImageType * mask) +{ + m_FixedWeightedMask = mask; +} + +ElastixBase::MaskImageType * +ElastixBase::GetModifiableFixedWeightedMask() +{ + return m_FixedWeightedMask; +} + +void +ElastixBase::SetMovingWeightedMask(const MaskImageType * mask) +{ + m_MovingWeightedMask = mask; +} + +ElastixBase::MaskImageType * +ElastixBase::GetModifiableMovingWeightedMask() +{ + return m_MovingWeightedMask; +} } // end namespace elastix diff --git a/Core/Kernel/elxElastixBase.h b/Core/Kernel/elxElastixBase.h index 836f24ecc..99c6d21d4 100644 --- a/Core/Kernel/elxElastixBase.h +++ b/Core/Kernel/elxElastixBase.h @@ -299,6 +299,14 @@ class ElastixBase elxSetObjectMacro(FinalTransform, itk::Object); elxGetObjectMacro(FinalTransform, itk::Object); + /** Set/Get the fixed weighted mask. */ + void SetFixedWeightedMask(const MaskImageType * mask); + MaskImageType * GetModifiableFixedWeightedMask(); + + /** Set/Get the moving weighted mask. */ + void SetMovingWeightedMask(const MaskImageType * mask); + MaskImageType * GetModifiableMovingWeightedMask(); + /** Empty Run()-function to be overridden. */ virtual int Run() = 0; @@ -540,6 +548,9 @@ class ElastixBase * From Elastix 4.3 to 4.7: Ignore direction cosines by default, for * backward compatability. From Elastix 4.8: set it to true by default. */ bool m_UseDirectionCosines{ true }; + + MaskImageType * m_FixedWeightedMask{ nullptr }; + MaskImageType * m_MovingWeightedMask{ nullptr }; }; } // end namespace elastix diff --git a/Core/Kernel/elxElastixMain.cxx b/Core/Kernel/elxElastixMain.cxx index 8d99ada38..ac7475f2b 100644 --- a/Core/Kernel/elxElastixMain.cxx +++ b/Core/Kernel/elxElastixMain.cxx @@ -31,7 +31,6 @@ using itk::Deref; /** * ********************* Constructor **************************** */ - ElastixMain::ElastixMain() = default; /** @@ -145,13 +144,15 @@ ElastixMain::Run() return 1; } - /** Set the images and masks. If not set by the user, it is not a problem. + /** Set the images, masks, and weighted masks. If not set by the user, it is not a problem. * ElastixTemplate will try to load them from disk. */ elastixBase.SetFixedImageContainer(this->GetModifiableFixedImageContainer()); elastixBase.SetMovingImageContainer(this->GetModifiableMovingImageContainer()); elastixBase.SetFixedMaskContainer(this->GetModifiableFixedMaskContainer()); elastixBase.SetMovingMaskContainer(this->GetModifiableMovingMaskContainer()); + elastixBase.SetFixedWeightedMask(this->GetModifiableFixedWeightedMask()); // Set fixed weighted mask + elastixBase.SetMovingWeightedMask(this->GetModifiableMovingWeightedMask()); // Set moving weighted mask elastixBase.SetResultImageContainer(this->GetModifiableResultImageContainer()); elastixBase.SetFixedPoints(m_FixedPoints); @@ -559,5 +560,40 @@ ElastixMain::GetImageInformationFromFile(const std::string & filename, ImageDime } // end GetImageInformationFromFile() +/** + * ******************** SetFixedWeightedMask ******************** + */ +void +ElastixMain::SetFixedWeightedMask(const MaskImageType * mask) +{ + m_FixedWeightedMask = mask; +} + +/** + * ******************** GetModifiableFixedWeightedMask ******************** + */ +ElastixMain::MaskImageType * +ElastixMain::GetModifiableFixedWeightedMask() +{ + return m_FixedWeightedMask; +} + +/** + * ******************** SetMovingWeightedMask ******************** + */ +void +ElastixMain::SetMovingWeightedMask(const MaskImageType * mask) +{ + m_MovingWeightedMask = mask; +} + +/** + * ******************** GetModifiableMovingWeightedMask ******************** + */ +ElastixMain::MaskImageType * +ElastixMain::GetModifiableMovingWeightedMask() +{ + return m_MovingWeightedMask; +} } // end namespace elastix diff --git a/Core/Kernel/elxElastixMain.h b/Core/Kernel/elxElastixMain.h index 37b6a3f3d..6eabf626e 100644 --- a/Core/Kernel/elxElastixMain.h +++ b/Core/Kernel/elxElastixMain.h @@ -98,9 +98,23 @@ class ElastixMain : public MainBase itkGetModifiableObjectMacro(FixedMaskContainer, DataObjectContainerType); itkGetModifiableObjectMacro(MovingMaskContainer, DataObjectContainerType); + /** Set/Get functions for the fixed and moving weighted masks. */ + itkSetObjectMacro(FixedWeightedMask, MaskImageType); + itkSetObjectMacro(MovingWeightedMask, MaskImageType); + itkGetModifiableObjectMacro(FixedWeightedMask, MaskImageType); + itkGetModifiableObjectMacro(MovingWeightedMask, MaskImageType); + itkSetConstObjectMacro(FixedPoints, itk::Object); itkSetConstObjectMacro(MovingPoints, itk::Object); + /** Set/Get the fixed weighted mask. */ + void SetFixedWeightedMask(const MaskImageType * mask); + MaskImageType * GetModifiableFixedWeightedMask(); + + /** Set/Get the moving weighted mask. */ + void SetMovingWeightedMask(const MaskImageType * mask); + MaskImageType * GetModifiableMovingWeightedMask(); + /** Get the final transform (the result of running elastix). * You may pass this as an InitialTransform in an other instantiation * of ElastixMain. @@ -181,6 +195,9 @@ class ElastixMain : public MainBase itk::SmartPointer m_FixedPoints{ nullptr }; itk::SmartPointer m_MovingPoints{ nullptr }; + /** Weighted masks for fixed and moving images. */ + MaskImageType::Pointer m_FixedWeightedMask; + MaskImageType::Pointer m_MovingWeightedMask; /** A transform that is the result of registration. */ ObjectPointer m_FinalTransform{ nullptr }; diff --git a/Core/Kernel/elxElastixTemplate.h b/Core/Kernel/elxElastixTemplate.h index 6297f9c3e..62e63a2c0 100644 --- a/Core/Kernel/elxElastixTemplate.h +++ b/Core/Kernel/elxElastixTemplate.h @@ -209,6 +209,16 @@ class ITK_TEMPLATE_EXPORT ElastixTemplate final : public ElastixBase MovingMaskType * GetMovingMask(unsigned int idx = 0) const; + /** Get pointers to the weighted masks. They are obtained from the + * {Fixed,Moving}WeightedMaskContainer and casted to the appropriate type. + */ + + FixedMaskType * + GetFixedWeightedMask() const; + + MovingMaskType * + GetMovingWeightedMask() const; + /** Main functions: * Run() for registration, and ApplyTransform() for just * applying a transform to an image. diff --git a/Core/Kernel/elxElastixTemplate.hxx b/Core/Kernel/elxElastixTemplate.hxx index c42353f12..baa831218 100644 --- a/Core/Kernel/elxElastixTemplate.hxx +++ b/Core/Kernel/elxElastixTemplate.hxx @@ -107,6 +107,24 @@ ElastixTemplate::GetMovingMask(unsigned int idx) cons } // end SetMovingMask() +/** + * ********************** GetFixedWeightedMask ************************* + */ +template +typename ElastixTemplate::FixedMaskType * +ElastixTemplate::GetFixedWeightedMask() const +{ + return dynamic_cast(this->GetModifiableFixedWeightedMask()); +} +/** + * ********************** GetMovingWeightedMask ************************* + */ +template +typename ElastixTemplate::MovingMaskType * +ElastixTemplate::GetMovingWeightedMask() const +{ + return dynamic_cast(this->GetModifiableMovingWeightedMask()); +} /** * **************************** Run ***************************** diff --git a/Core/Main/itkElastixRegistrationMethod.h b/Core/Main/itkElastixRegistrationMethod.h index 0ca0ae474..955501773 100644 --- a/Core/Main/itkElastixRegistrationMethod.h +++ b/Core/Main/itkElastixRegistrationMethod.h @@ -166,6 +166,34 @@ class ITK_TEMPLATE_EXPORT ElastixRegistrationMethod : public itk::ImageSource); itkSetConstObjectMacro(MovingPoints, PointContainerType); diff --git a/Core/Main/itkElastixRegistrationMethod.hxx b/Core/Main/itkElastixRegistrationMethod.hxx index 52b242b3f..56b8e911d 100644 --- a/Core/Main/itkElastixRegistrationMethod.hxx +++ b/Core/Main/itkElastixRegistrationMethod.hxx @@ -1050,6 +1050,90 @@ ElastixRegistrationMethod::ConvertToItkTransform(cons itkGenericExceptionMacro("Failed to convert transform object " << elxTransform); } +template +void +ElastixRegistrationMethod::AddFixedWeightedMask(FixedMaskType * fixedWeightedMask) +{ + this->GetElastixMain()->SetFixedWeightedMask(fixedWeightedMask); +} + +template +void +ElastixRegistrationMethod::SetFixedWeightedMask(FixedMaskType * fixedWeightedMask) +{ + this->GetElastixMain()->SetFixedWeightedMask(fixedWeightedMask); +} + +template +const typename ElastixRegistrationMethod::FixedMaskType * +ElastixRegistrationMethod::GetFixedWeightedMask() const +{ + return this->GetElastixMain()->GetModifiableFixedWeightedMask(); +} + +template +const typename ElastixRegistrationMethod::FixedMaskType * +ElastixRegistrationMethod::GetFixedWeightedMask(const unsigned int index) const +{ + return this->GetElastixMain()->GetModifiableFixedWeightedMask(); +} + +template +void +ElastixRegistrationMethod::RemoveFixedWeightedMask() +{ + this->GetElastixMain()->SetFixedWeightedMask(nullptr); +} + +template +unsigned int +ElastixRegistrationMethod::GetNumberOfFixedWeightedMasks() const +{ + return this->GetElastixMain()->GetModifiableFixedWeightedMask() ? 1 : 0; +} + +template +void +ElastixRegistrationMethod::SetMovingWeightedMask(MovingMaskType * movingWeightedMask) +{ + this->GetElastixMain()->SetMovingWeightedMask(movingWeightedMask); +} + +template +void +ElastixRegistrationMethod::AddMovingWeightedMask(MovingMaskType * movingWeightedMask) +{ + this->GetElastixMain()->SetMovingWeightedMask(movingWeightedMask); +} + +template +const typename ElastixRegistrationMethod::MovingMaskType * +ElastixRegistrationMethod::GetMovingWeightedMask() const +{ + return this->GetElastixMain()->GetModifiableMovingWeightedMask(); +} + +template +const typename ElastixRegistrationMethod::MovingMaskType * +ElastixRegistrationMethod::GetMovingWeightedMask(const unsigned int index) const +{ + return this->GetElastixMain()->GetModifiableMovingWeightedMask(); +} + +template +void +ElastixRegistrationMethod::RemoveMovingWeightedMask() +{ + this->GetElastixMain()->SetMovingWeightedMask(nullptr); +} + +template +unsigned int +ElastixRegistrationMethod::GetNumberOfMovingWeightedMasks() const +{ + return this->GetElastixMain()->GetModifiableMovingWeightedMask() ? 1 : 0; +} + } // namespace itk #endif From f358ed46a21a81a7ff8ff8c554d854e29c8ac5f1 Mon Sep 17 00:00:00 2001 From: Julieta Mateos Date: Thu, 12 Dec 2024 19:48:33 -0500 Subject: [PATCH 2/8] saving the commit message --- Core/Kernel/elxElastixBase.h | 4 ++++ Core/Kernel/elxElastixMain.h | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/Core/Kernel/elxElastixBase.h b/Core/Kernel/elxElastixBase.h index 99c6d21d4..9b47e1633 100644 --- a/Core/Kernel/elxElastixBase.h +++ b/Core/Kernel/elxElastixBase.h @@ -175,6 +175,10 @@ class ElastixBase /** Typedef that is used in the elastix dll version. */ using ParameterMapType = itk::ParameterMapInterface::ParameterMapType; + /** Types for the masks. */ + using MaskPixelType = unsigned char; + using MaskImageType = itk::Image::ImageDimension>; + /** Set/Get the Configuration Object. */ elxGetObjectMacro(Configuration, Configuration); elxSetObjectMacro(Configuration, Configuration); diff --git a/Core/Kernel/elxElastixMain.h b/Core/Kernel/elxElastixMain.h index 6eabf626e..29cb6d75c 100644 --- a/Core/Kernel/elxElastixMain.h +++ b/Core/Kernel/elxElastixMain.h @@ -19,6 +19,9 @@ #define elxElastixMain_h #include "elxMainBase.h" +#include "itkImage.h" +#include "itkSmartPointer.h" +#include "itkObject.h" namespace elastix @@ -82,6 +85,13 @@ class ElastixMain : public MainBase /** Run-time type information (and related methods). */ itkOverrideGetNameOfClassMacro(ElastixMain); + /** Types for the masks. */ + using MaskPixelType = unsigned char; + // Ensure FixedImageType and MovingImageType are defined before using them + using FixedImageType = itk::Image; // Example definition, adjust as necessary + using MovingImageType = itk::Image; // Example definition, adjust as necessary + using MaskImageType = itk::Image::ImageDimension>; + /** Set/Get functions for the fixed images * (if these are not used, elastix tries to read them from disk, * according to the command line parameters). From d7059d997e5182bb19ef3791dc07ad4b7c70aba2 Mon Sep 17 00:00:00 2001 From: Julieta Mateos Date: Thu, 12 Dec 2024 20:06:04 -0500 Subject: [PATCH 3/8] definitions --- Core/Kernel/elxComponentDatabase.h | 26 ++++++++++++++++++++++++++ Core/Kernel/elxElastixMain.h | 4 ---- Core/Kernel/elxElastixTemplate.h | 1 + Core/Kernel/elxMainBase.h | 10 ++++++++++ 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 Core/Kernel/elxComponentDatabase.h diff --git a/Core/Kernel/elxComponentDatabase.h b/Core/Kernel/elxComponentDatabase.h new file mode 100644 index 000000000..e25691ac6 --- /dev/null +++ b/Core/Kernel/elxComponentDatabase.h @@ -0,0 +1,26 @@ +#include "itkImage.h" +#include "itkSmartPointer.h" +#include "itkObject.h" +// Include the headers where FixedImageType and MovingImageType are defined +// If they are not defined elsewhere, define them here +// #include "itkFixedImageType.h" +// #include "itkMovingImageType.h" + +namespace elastix +{ + +class ComponentDatabase : public itk::Object +{ +public: + + /** Types for the masks. */ + using MaskPixelType = unsigned char; + // Define FixedImageType and MovingImageType if not defined elsewhere + using FixedImageType = itk::Image; // Example definition, adjust as necessary + using MovingImageType = itk::Image; // Example definition, adjust as necessary + using MaskImageType = itk::Image::ImageDimension>; + +}; +} // end namespace elastix + +#endif // end #ifndef elxComponentDatabase_h diff --git a/Core/Kernel/elxElastixMain.h b/Core/Kernel/elxElastixMain.h index 29cb6d75c..3e7d41500 100644 --- a/Core/Kernel/elxElastixMain.h +++ b/Core/Kernel/elxElastixMain.h @@ -23,7 +23,6 @@ #include "itkSmartPointer.h" #include "itkObject.h" - namespace elastix { @@ -87,9 +86,6 @@ class ElastixMain : public MainBase /** Types for the masks. */ using MaskPixelType = unsigned char; - // Ensure FixedImageType and MovingImageType are defined before using them - using FixedImageType = itk::Image; // Example definition, adjust as necessary - using MovingImageType = itk::Image; // Example definition, adjust as necessary using MaskImageType = itk::Image::ImageDimension>; /** Set/Get functions for the fixed images diff --git a/Core/Kernel/elxElastixTemplate.h b/Core/Kernel/elxElastixTemplate.h index 62e63a2c0..bcf3d315a 100644 --- a/Core/Kernel/elxElastixTemplate.h +++ b/Core/Kernel/elxElastixTemplate.h @@ -34,6 +34,7 @@ #include #include #include +#include "itkSmartPointer.h" #include diff --git a/Core/Kernel/elxMainBase.h b/Core/Kernel/elxMainBase.h index 6f4a75ff4..daedeba10 100644 --- a/Core/Kernel/elxMainBase.h +++ b/Core/Kernel/elxMainBase.h @@ -24,6 +24,9 @@ #include "itkParameterMapInterface.h" #include +#include "itkImage.h" +#include "itkSmartPointer.h" +#include "itkObject.h" // Standard C++ header files: #include @@ -164,6 +167,13 @@ class MainBase : public itk::Object static const ComponentDatabase & GetComponentDatabase(); + /** Types for the masks. */ + using MaskPixelType = unsigned char; + // Define FixedImageType and MovingImageType if not defined elsewhere + using FixedImageType = itk::Image; // Example definition, adjust as necessary + using MovingImageType = itk::Image; // Example definition, adjust as necessary + using MaskImageType = itk::Image::ImageDimension>; + protected: MainBase(); ~MainBase() override = 0; From 5c93023a719ec4d8af66235a176155741887e0a6 Mon Sep 17 00:00:00 2001 From: Julieta Mateos Date: Thu, 12 Dec 2024 20:09:11 -0500 Subject: [PATCH 4/8] def --- Core/Kernel/elxElastixMain.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/Core/Kernel/elxElastixMain.h b/Core/Kernel/elxElastixMain.h index 3e7d41500..545ef6de8 100644 --- a/Core/Kernel/elxElastixMain.h +++ b/Core/Kernel/elxElastixMain.h @@ -84,9 +84,6 @@ class ElastixMain : public MainBase /** Run-time type information (and related methods). */ itkOverrideGetNameOfClassMacro(ElastixMain); - /** Types for the masks. */ - using MaskPixelType = unsigned char; - using MaskImageType = itk::Image::ImageDimension>; /** Set/Get functions for the fixed images * (if these are not used, elastix tries to read them from disk, From 70bea1a01b01677241623c23f0116dd4e3fadf90 Mon Sep 17 00:00:00 2001 From: Julieta Mateos Date: Fri, 13 Dec 2024 10:42:03 -0500 Subject: [PATCH 5/8] vardeinitions --- Core/Kernel/elxComponentDatabase.h | 3 ++- Core/Kernel/elxElastixBase.h | 3 +++ Core/Kernel/elxElastixMain.h | 9 +++++++++ Core/Kernel/elxElastixTemplate.h | 1 + Core/Kernel/elxMainBase.h | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Core/Kernel/elxComponentDatabase.h b/Core/Kernel/elxComponentDatabase.h index e25691ac6..36c9c48f4 100644 --- a/Core/Kernel/elxComponentDatabase.h +++ b/Core/Kernel/elxComponentDatabase.h @@ -15,10 +15,11 @@ class ComponentDatabase : public itk::Object /** Types for the masks. */ using MaskPixelType = unsigned char; + // Ensure MaskImageType is defined before using it + using MaskImageType = itk::Image::ImageDimension>; // Define FixedImageType and MovingImageType if not defined elsewhere using FixedImageType = itk::Image; // Example definition, adjust as necessary using MovingImageType = itk::Image; // Example definition, adjust as necessary - using MaskImageType = itk::Image::ImageDimension>; }; } // end namespace elastix diff --git a/Core/Kernel/elxElastixBase.h b/Core/Kernel/elxElastixBase.h index 9b47e1633..44d04fab3 100644 --- a/Core/Kernel/elxElastixBase.h +++ b/Core/Kernel/elxElastixBase.h @@ -42,6 +42,9 @@ #include #include #include +#include "itkImage.h" +#include "itkSmartPointer.h" +#include "itkObject.h" #include #include diff --git a/Core/Kernel/elxElastixMain.h b/Core/Kernel/elxElastixMain.h index 545ef6de8..cc729f505 100644 --- a/Core/Kernel/elxElastixMain.h +++ b/Core/Kernel/elxElastixMain.h @@ -23,6 +23,11 @@ #include "itkSmartPointer.h" #include "itkObject.h" +// Ensure FixedImageType and MovingImageType are defined +// If they are not defined elsewhere, define them here +using FixedImageType = itk::Image; // Example definition, adjust as necessary +using MovingImageType = itk::Image; // Example definition, adjust as necessary + namespace elastix { @@ -84,6 +89,10 @@ class ElastixMain : public MainBase /** Run-time type information (and related methods). */ itkOverrideGetNameOfClassMacro(ElastixMain); + /** Types for the masks. */ + using MaskPixelType = unsigned char; + // Ensure MaskImageType is defined before using it + using MaskImageType = itk::Image::ImageDimension>; /** Set/Get functions for the fixed images * (if these are not used, elastix tries to read them from disk, diff --git a/Core/Kernel/elxElastixTemplate.h b/Core/Kernel/elxElastixTemplate.h index bcf3d315a..845856088 100644 --- a/Core/Kernel/elxElastixTemplate.h +++ b/Core/Kernel/elxElastixTemplate.h @@ -131,6 +131,7 @@ class ITK_TEMPLATE_EXPORT ElastixTemplate final : public ElastixBase /** Types for the masks. */ using MaskPixelType = unsigned char; + using MaskImageType = itk::Image::ImageDimension>; using FixedMaskType = itk::Image; using MovingMaskType = itk::Image; using FixedMaskPointer = typename FixedMaskType::Pointer; diff --git a/Core/Kernel/elxMainBase.h b/Core/Kernel/elxMainBase.h index daedeba10..3db1adc55 100644 --- a/Core/Kernel/elxMainBase.h +++ b/Core/Kernel/elxMainBase.h @@ -172,6 +172,7 @@ class MainBase : public itk::Object // Define FixedImageType and MovingImageType if not defined elsewhere using FixedImageType = itk::Image; // Example definition, adjust as necessary using MovingImageType = itk::Image; // Example definition, adjust as necessary + // Ensure MaskImageType is defined before using it using MaskImageType = itk::Image::ImageDimension>; protected: From 51bdc7939ba40d37fbb79a145cc55f3e506d065c Mon Sep 17 00:00:00 2001 From: Julieta Mateos Date: Fri, 13 Dec 2024 10:59:55 -0500 Subject: [PATCH 6/8] definitions --- Core/Kernel/elxComponentDatabase.h | 7 ++++--- Core/Kernel/elxElastixBase.h | 4 ++++ Core/Kernel/elxElastixMain.h | 4 +--- Core/Kernel/elxMainBase.h | 7 +++---- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Core/Kernel/elxComponentDatabase.h b/Core/Kernel/elxComponentDatabase.h index 36c9c48f4..edf7d1d49 100644 --- a/Core/Kernel/elxComponentDatabase.h +++ b/Core/Kernel/elxComponentDatabase.h @@ -6,6 +6,10 @@ // #include "itkFixedImageType.h" // #include "itkMovingImageType.h" +// Ensure FixedImageType and MovingImageType are defined before using MaskImageType +using FixedImageType = itk::Image; // Example definition, adjust as necessary +using MovingImageType = itk::Image; // Example definition, adjust as necessary + namespace elastix { @@ -17,9 +21,6 @@ class ComponentDatabase : public itk::Object using MaskPixelType = unsigned char; // Ensure MaskImageType is defined before using it using MaskImageType = itk::Image::ImageDimension>; - // Define FixedImageType and MovingImageType if not defined elsewhere - using FixedImageType = itk::Image; // Example definition, adjust as necessary - using MovingImageType = itk::Image; // Example definition, adjust as necessary }; } // end namespace elastix diff --git a/Core/Kernel/elxElastixBase.h b/Core/Kernel/elxElastixBase.h index 44d04fab3..85f15724b 100644 --- a/Core/Kernel/elxElastixBase.h +++ b/Core/Kernel/elxElastixBase.h @@ -46,6 +46,10 @@ #include "itkSmartPointer.h" #include "itkObject.h" +// Ensure FixedImageType and MovingImageType are defined before using MaskImageType +using FixedImageType = itk::Image; // Example definition, adjust as necessary +using MovingImageType = itk::Image; // Example definition, adjust as necessary + #include #include diff --git a/Core/Kernel/elxElastixMain.h b/Core/Kernel/elxElastixMain.h index cc729f505..e53894f19 100644 --- a/Core/Kernel/elxElastixMain.h +++ b/Core/Kernel/elxElastixMain.h @@ -23,8 +23,7 @@ #include "itkSmartPointer.h" #include "itkObject.h" -// Ensure FixedImageType and MovingImageType are defined -// If they are not defined elsewhere, define them here +// Ensure FixedImageType and MovingImageType are defined before using MaskImageType using FixedImageType = itk::Image; // Example definition, adjust as necessary using MovingImageType = itk::Image; // Example definition, adjust as necessary @@ -91,7 +90,6 @@ class ElastixMain : public MainBase /** Types for the masks. */ using MaskPixelType = unsigned char; - // Ensure MaskImageType is defined before using it using MaskImageType = itk::Image::ImageDimension>; /** Set/Get functions for the fixed images diff --git a/Core/Kernel/elxMainBase.h b/Core/Kernel/elxMainBase.h index 3db1adc55..4892f46a2 100644 --- a/Core/Kernel/elxMainBase.h +++ b/Core/Kernel/elxMainBase.h @@ -33,6 +33,9 @@ #include #include +// Ensure FixedImageType and MovingImageType are defined before using MaskImageType +using FixedImageType = itk::Image; // Example definition, adjust as necessary +using MovingImageType = itk::Image; // Example definition, adjust as necessary namespace elastix { @@ -169,10 +172,6 @@ class MainBase : public itk::Object /** Types for the masks. */ using MaskPixelType = unsigned char; - // Define FixedImageType and MovingImageType if not defined elsewhere - using FixedImageType = itk::Image; // Example definition, adjust as necessary - using MovingImageType = itk::Image; // Example definition, adjust as necessary - // Ensure MaskImageType is defined before using it using MaskImageType = itk::Image::ImageDimension>; protected: From ada79024da23601ab678bf094313bb39f62f604e Mon Sep 17 00:00:00 2001 From: Julieta Mateos Date: Fri, 13 Dec 2024 11:23:37 -0500 Subject: [PATCH 7/8] parameterobject_mod --- Core/Kernel/elxParameterObject.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Core/Kernel/elxParameterObject.h diff --git a/Core/Kernel/elxParameterObject.h b/Core/Kernel/elxParameterObject.h new file mode 100644 index 000000000..b994a5499 --- /dev/null +++ b/Core/Kernel/elxParameterObject.h @@ -0,0 +1,19 @@ +// ...existing code... + +// Ensure FixedImageType and MovingImageType are defined before using MaskImageType +using FixedImageType = itk::Image; // Example definition, adjust as necessary +using MovingImageType = itk::Image; // Example definition, adjust as necessary + +namespace elastix +{ +// ...existing code... + + /** Types for the masks. */ + using MaskPixelType = unsigned char; + using MaskImageType = itk::Image::ImageDimension>; + +// ...existing code... +}; +} // end namespace elastix + +#endif // end #ifndef elxParameterObject_h From 816c903846985c2c6c432492d5635d227c4f7444 Mon Sep 17 00:00:00 2001 From: Julieta Mateos Date: Fri, 13 Dec 2024 11:47:40 -0500 Subject: [PATCH 8/8] wmask_delatation --- Core/Kernel/elxElastixBase.h | 4 ++++ Core/Kernel/elxElastixMain.h | 21 ++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Core/Kernel/elxElastixBase.h b/Core/Kernel/elxElastixBase.h index 85f15724b..d037364a5 100644 --- a/Core/Kernel/elxElastixBase.h +++ b/Core/Kernel/elxElastixBase.h @@ -50,6 +50,10 @@ using FixedImageType = itk::Image; // Example definition, adjust as necessary using MovingImageType = itk::Image; // Example definition, adjust as necessary +// Types for the masks +using MaskPixelType = unsigned char; +using MaskImageType = itk::Image::ImageDimension>; + #include #include diff --git a/Core/Kernel/elxElastixMain.h b/Core/Kernel/elxElastixMain.h index e53894f19..bee07365f 100644 --- a/Core/Kernel/elxElastixMain.h +++ b/Core/Kernel/elxElastixMain.h @@ -108,22 +108,21 @@ class ElastixMain : public MainBase itkGetModifiableObjectMacro(FixedMaskContainer, DataObjectContainerType); itkGetModifiableObjectMacro(MovingMaskContainer, DataObjectContainerType); - /** Set/Get functions for the fixed and moving weighted masks. */ - itkSetObjectMacro(FixedWeightedMask, MaskImageType); - itkSetObjectMacro(MovingWeightedMask, MaskImageType); + /** + * Set/Get functions for the fixed and moving weighted masks. + * These masks are used to apply weights to different regions of the fixed and moving images + * during the registration process. The weights can influence the registration by giving more + * importance to certain areas of the images. + */ + + itkGetModifiableObjectMacro(FixedWeightedMask, MaskImageType); itkGetModifiableObjectMacro(MovingWeightedMask, MaskImageType); - itkSetConstObjectMacro(FixedPoints, itk::Object); - itkSetConstObjectMacro(MovingPoints, itk::Object); + itkGetConstObjectMacro(FixedWeightedPoints, itk::Object); + itkGetConstObjectMacro(MovingWeightedPoints, itk::Object); - /** Set/Get the fixed weighted mask. */ - void SetFixedWeightedMask(const MaskImageType * mask); - MaskImageType * GetModifiableFixedWeightedMask(); - /** Set/Get the moving weighted mask. */ - void SetMovingWeightedMask(const MaskImageType * mask); - MaskImageType * GetModifiableMovingWeightedMask(); /** Get the final transform (the result of running elastix). * You may pass this as an InitialTransform in an other instantiation