new R23MetaInfo so that R23 does not need TransformMeta anymore

This commit is contained in:
Proton local user
2023-05-12 14:00:32 +02:00
parent 07db119315
commit c67281a10a
7 changed files with 103 additions and 46 deletions

View File

@ -518,7 +518,27 @@ RTGeometryMetaInformation
} }
R23MetaInformation::
R23MetaInformation (){
m_DegreeOfFreedom = tDegreeOfFreedomEnum::UNKNOWN;
}
void
R23MetaInformation
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
}
R23MetaInformation
::~R23MetaInformation ()
{
}
TransformMetaInformation :: TransformMetaInformation ::
TransformMetaInformation (){ TransformMetaInformation (){
@ -531,11 +551,11 @@ TransformMetaInformation (){
m_UserTranslations.Fill(0.); m_UserTranslations.Fill(0.);
m_ReferenceTransform.Fill(0.); //m_ReferenceTransform.Fill(0.);
m_CurrentTransform.Fill(0.); //m_CurrentTransform.Fill(0.);
m_DegreeOfFreedom = tDegreeOfFreedomEnum::UNKNOWN; // m_DegreeOfFreedom = tDegreeOfFreedomEnum::UNKNOWN;
} }

View File

@ -514,6 +514,48 @@ private:
}; };
class R23MetaInformation :
public itk::Object{
public:
/** standard typedefs **/
typedef R23MetaInformation Self;
typedef itk::Object Superclass;
typedef itk::SmartPointer<Self> Pointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(R23MetaInformation, itk::Object);
/** object information streaming **/
void PrintSelf(std::ostream& os, itk::Indent indent) const;
itkSetEnumMacro(DegreeOfFreedom, tDegreeOfFreedomEnum);
itkGetEnumMacro(DegreeOfFreedom, tDegreeOfFreedomEnum);
protected:
tDegreeOfFreedomEnum
m_DegreeOfFreedom;
/** Default Constructor **/
R23MetaInformation ();
/** Default Destructor **/
virtual ~R23MetaInformation ();
private:
/** purposely not implemented **/
R23MetaInformation (const Self&);
/** purposely not implemented **/
void operator=(const Self&);
};
class TransformMetaInformation : class TransformMetaInformation :
public itk::Object{ public itk::Object{
@ -547,14 +589,14 @@ public:
itkSetMacro(UserRotations,PointType); itkSetMacro(UserRotations,PointType);
itkGetMacro(UserRotations,PointType); itkGetMacro(UserRotations,PointType);
itkSetMacro(ReferenceTransform,TransformMatrixType); // itkSetMacro(ReferenceTransform,TransformMatrixType);
itkGetMacro(ReferenceTransform,TransformMatrixType); // itkGetMacro(ReferenceTransform,TransformMatrixType);
itkSetMacro(CurrentTransform,TransformMatrixType); // itkSetMacro(CurrentTransform,TransformMatrixType);
itkGetMacro(CurrentTransform,TransformMatrixType); // itkGetMacro(CurrentTransform,TransformMatrixType);
itkSetEnumMacro(DegreeOfFreedom, tDegreeOfFreedomEnum); // itkSetEnumMacro(DegreeOfFreedom, tDegreeOfFreedomEnum);
itkGetEnumMacro(DegreeOfFreedom, tDegreeOfFreedomEnum); // itkGetEnumMacro(DegreeOfFreedom, tDegreeOfFreedomEnum);
protected: protected:
@ -564,12 +606,12 @@ protected:
m_UserTranslations, m_UserTranslations,
m_UserRotations; m_UserRotations;
TransformMatrixType // TransformMatrixType
m_ReferenceTransform, // m_ReferenceTransform,
m_CurrentTransform; // m_CurrentTransform;
tDegreeOfFreedomEnum // tDegreeOfFreedomEnum
m_DegreeOfFreedom; // m_DegreeOfFreedom;
/** Default Constructor **/ /** Default Constructor **/
TransformMetaInformation (); TransformMetaInformation ();

View File

@ -170,8 +170,8 @@ public:
itkGetConstObjectMacro(Interpolator2, InterpolatorType); itkGetConstObjectMacro(Interpolator2, InterpolatorType);
/** Set/Get the Meta informations. */ /** Set/Get the Meta informations. */
itkSetObjectMacro(TransformMetaInfo, TransformMetaInformation); itkSetObjectMacro(TransformMetaInfo, R23MetaInformation);
itkGetConstObjectMacro(TransformMetaInfo, TransformMetaInformation); itkGetConstObjectMacro(TransformMetaInfo, R23MetaInformation);
/** Set/Get the output filters. */ /** Set/Get the output filters. */
itkSetObjectMacro(Filter1, ChangeInformationFilterType); itkSetObjectMacro(Filter1, ChangeInformationFilterType);
@ -253,7 +253,10 @@ private:
InterpolatorPointer m_Interpolator1; InterpolatorPointer m_Interpolator1;
InterpolatorPointer m_Interpolator2; InterpolatorPointer m_Interpolator2;
TransformMetaInformation::Pointer //TransformMetaInformation::Pointer
// m_TransformMetaInfo;
R23MetaInformation::Pointer
m_TransformMetaInfo; m_TransformMetaInfo;
ChangeInformationFilterPointer ChangeInformationFilterPointer

View File

@ -185,10 +185,10 @@ public:
itkGetConstReferenceMacro(NumberOfPixelsCounted, unsigned long); itkGetConstReferenceMacro(NumberOfPixelsCounted, unsigned long);
/** Connect the DRTGeometryMetaInfo. */ /** Connect the DRTGeometryMetaInfo. */
itkSetObjectMacro(TransformMetaInfo, TransformMetaInformation); itkSetObjectMacro(TransformMetaInfo, R23MetaInformation);
/** Get a pointer to the DRTGeometryMetaInfo. */ /** Get a pointer to the DRTGeometryMetaInfo. */
itkGetConstObjectMacro(TransformMetaInfo, TransformMetaInformation); itkGetConstObjectMacro(TransformMetaInfo, R23MetaInformation);
/** Set the region over which the metric will be computed */ /** Set the region over which the metric will be computed */
itkSetMacro(FixedImageRegion1, FixedImageRegionType); itkSetMacro(FixedImageRegion1, FixedImageRegionType);
@ -274,7 +274,7 @@ protected:
mutable FixedImageMaskPointer m_FixedImageMask2; mutable FixedImageMaskPointer m_FixedImageMask2;
mutable MovingImageMaskPointer m_MovingImageMask; mutable MovingImageMaskPointer m_MovingImageMask;
TransformMetaInformation::Pointer R23MetaInformation::Pointer
m_TransformMetaInfo; m_TransformMetaInfo;
ChangeInformationFilterPointer ChangeInformationFilterPointer

View File

@ -113,7 +113,9 @@ bool gTwoImageToOneImageMetric<TFixedImage, TMovingImage>::SetTransformParameter
transformParameters[4] = TranslationAlongY; transformParameters[4] = TranslationAlongY;
transformParameters[5] = TranslationAlongZ; transformParameters[5] = TranslationAlongZ;
bool transformValid = (std::abs(TranslationAlongX) < m_MaxTranslation) && (std::abs(TranslationAlongY) < m_MaxTranslation) && (std::abs(TranslationAlongZ) < m_MaxTranslation); bool transformValid = (std::abs(TranslationAlongX) < m_MaxTranslation) &&
(std::abs(TranslationAlongY) < m_MaxTranslation) &&
(std::abs(TranslationAlongZ) < m_MaxTranslation);
if (transformValid) { if (transformValid) {
m_Transform1->SetParameters(transformParameters); m_Transform1->SetParameters(transformParameters);

View File

@ -118,6 +118,9 @@ itkImageProcessor::itkImageProcessor()
m_TransformMetaInfo = NULL; m_TransformMetaInfo = NULL;
m_TransformMetaInfo = TransformMetaInformation::New(); m_TransformMetaInfo = TransformMetaInformation::New();
m_r23MetaInfo = NULL;
m_r23MetaInfo = R23MetaInformation::New();
/* Initialise the projection geoemtry with defaults */ /* Initialise the projection geoemtry with defaults */
m_DRTGeometryMetaInfo = NULL; m_DRTGeometryMetaInfo = NULL;
m_DRTGeometryMetaInfo m_DRTGeometryMetaInfo
@ -284,13 +287,16 @@ double itkImageProcessor::GetPanelOffset2(){
void itkImageProcessor::SetDegreeOfFreedom(tDegreeOfFreedomEnum dof) void itkImageProcessor::SetDegreeOfFreedom(tDegreeOfFreedomEnum dof)
{ {
m_TransformMetaInfo->SetDegreeOfFreedom(dof); // m_TransformMetaInfo->SetDegreeOfFreedom(dof);
m_r23MetaInfo->SetDegreeOfFreedom(dof);
} }
tDegreeOfFreedomEnum tDegreeOfFreedomEnum
itkImageProcessor::GetDegreeOfFreedom() itkImageProcessor::GetDegreeOfFreedom()
{ {
return m_TransformMetaInfo->GetDegreeOfFreedom(); return
m_r23MetaInfo->GetDegreeOfFreedom();
//m_TransformMetaInfo->GetDegreeOfFreedom();
} }
void itkImageProcessor::SetCustom_ImportTransform(double dTx, void itkImageProcessor::SetCustom_ImportTransform(double dTx,
@ -428,6 +434,7 @@ int itkImageProcessor::unload3DVolumeAndMeta(){
m_TransformMetaInfo = NULL; m_TransformMetaInfo = NULL;
m_TransformMetaInfo = TransformMetaInformation::New(); m_TransformMetaInfo = TransformMetaInformation::New();
return 1; return 1;
} }
@ -1436,7 +1443,8 @@ void itkImageProcessor::InitializeRegistration(
metric->SetSubtractMean(true); metric->SetSubtractMean(true);
metric->SetMaxTranslation(maxTranslation); metric->SetMaxTranslation(maxTranslation);
m_TransformMetaInfo->SetDegreeOfFreedom(dof); // m_TransformMetaInfo->SetDegreeOfFreedom(dof);
m_r23MetaInfo->SetDegreeOfFreedom(dof);
mimetric->ComputeGradientOff(); mimetric->ComputeGradientOff();
@ -1479,7 +1487,8 @@ void itkImageProcessor::InitializeRegistration(
} }
registration->SetTransformMetaInfo(m_TransformMetaInfo); // registration->SetTransformMetaInfo(m_TransformMetaInfo);
registration->SetTransformMetaInfo(m_r23MetaInfo);
registration->SetFilter1(filter1); registration->SetFilter1(filter1);
registration->SetFilter2(filter2); registration->SetFilter2(filter2);

View File

@ -269,18 +269,6 @@ private:
TransformType::Pointer transform, TransformType::Pointer transform,
DRTImageMetaInformation::Pointer imageMetaInfo); DRTImageMetaInformation::Pointer imageMetaInfo);
// TransformType::Pointer
// CalculateInternalTransform(
// ImageType3D::PointType m_TranslationOffset,
// ImageType3D::PointType m_RotationOffset,
// ImageType3D::PointType m_TranslationUser,
// ImageType3D::PointType m_RotationUser,
// ImageType3D::PointType m_ProjectionTransformCenter,
// ImageType3D::PointType m_UserTransformCenter,
// ImageType3D::PointType m_OffsetTransformCenter,
// InternalImageType::DirectionType m_IECtoLPSDirections
// );
/* Calculate the transform used in siddon. /* Calculate the transform used in siddon.
* The isocentric transform is mapped to the calibrated center of projection */ * The isocentric transform is mapped to the calibrated center of projection */
TransformType::Pointer TransformType::Pointer
@ -294,8 +282,6 @@ private:
InternalImageType::DirectionType m_IECtoLPSDirections InternalImageType::DirectionType m_IECtoLPSDirections
); );
TransformType::Pointer TransformType::Pointer
transform1, transform1,
transform2; transform2;
@ -360,13 +346,6 @@ private:
); );
// ImageType3D::PointType
// CalcDRTImageOffset(
// ImageType3D::PointType m_DRTOffset,
// double dAngle,
// InternalImageType::DirectionType stdDRT2LPS
// );
TransformType::Pointer TransformType::Pointer
MapTransformToNewOrigin( MapTransformToNewOrigin(
ImageType3D::PointType m_COR, ImageType3D::PointType m_COR,
@ -433,6 +412,8 @@ private:
TransformMetaInformation::Pointer TransformMetaInformation::Pointer
m_TransformMetaInfo; m_TransformMetaInfo;
R23MetaInformation::Pointer
m_r23MetaInfo;
double m_OptmizerValue; double m_OptmizerValue;
int m_MaxNumberOfIterations; int m_MaxNumberOfIterations;