autoReg working

This commit is contained in:
Proton local user
2023-05-03 14:41:52 +02:00
parent f166060a71
commit 9b5921dd60
2 changed files with 290 additions and 291 deletions

View File

@ -1362,6 +1362,7 @@ void itkImageProcessor::CalculateExternalUserTransform(TransformType::Pointer tr
m_TransformMetaInfo->SetUserRotations(LPStoIEC_Directions * rotationUser);
}
itkImageProcessor::TransformType::Pointer
itkImageProcessor::CalculateInternalTransformV2(
ImageType3D::PointType m_TranslationOffset, //IEC
@ -1388,37 +1389,16 @@ itkImageProcessor::CalculateInternalTransformV2(
ImageType3D::PointType m_RUserLPS =
m_IECtoLPSDirections * m_RotationUser;
// TransformType::Pointer IsocetricTransform = TransformType::New();
// IsocetricTransform->SetComputeZYX(true);
// IsocetricTransform->SetIdentity();
TransformType::OutputVectorType translation;
translation[0] = m_TOffsetLPS[0] + m_TUserLPS[0];
translation[1] = m_TOffsetLPS[1] + m_TUserLPS[1];
translation[2] = m_TOffsetLPS[2] + m_TUserLPS[2];
// IsocetricTransform->SetTranslation(translation);
const double dtr = (atan(1.0) * 4.0) / 180.0;
// IsocetricTransform->SetRotation(
// dtr * m_ROffsetLPS[0] + dtr * m_RUserLPS[0],
// dtr * m_ROffsetLPS[1] + dtr * m_RUserLPS[1],
// dtr * m_ROffsetLPS[2] + dtr * m_RUserLPS[2]);
TransformType::OutputVectorType rotations;
rotations[0] = m_ROffsetLPS[0] + m_RUserLPS[0];
rotations[1] = m_ROffsetLPS[1] + m_RUserLPS[1];
rotations[2] = m_ROffsetLPS[2] + m_RUserLPS[2];
// ImageType3D::PointType m_TransformOrigin;
// m_TransformOrigin.Fill(0.);
// IsocetricTransform->SetCenter(
// m_TransformOrigin );
// IsocetricTransform->Print(std::cout);
// Map offset to the projection center
TransformType::Pointer m_outputTransform =
MapTransformToNewOrigin (
@ -1427,11 +1407,7 @@ itkImageProcessor::CalculateInternalTransformV2(
rotations
);
std::cout<<m_outputTransform->GetTranslation()<<std::endl;
std::cout<<m_outputTransform->GetCenter()<<std::endl;
m_outputTransform->SetCenter(m_CalibratedProjectionCenter);
std::cout<<m_outputTransform->GetTranslation()<<std::endl;
std::cout<<m_outputTransform->GetCenter()<<std::endl;
return m_outputTransform;
@ -1439,77 +1415,77 @@ itkImageProcessor::CalculateInternalTransformV2(
itkImageProcessor::TransformType::Pointer
itkImageProcessor::CalculateInternalTransform(
ImageType3D::PointType m_TranslationOffset, //IEC
ImageType3D::PointType m_RotationOffset, //IEC
ImageType3D::PointType m_TranslationUser, //IEC
ImageType3D::PointType m_RotationUser, //IEC
ImageType3D::PointType m_ProjectionTransformCenter, //LPS
ImageType3D::PointType m_UserTransformCenter, //LPS
ImageType3D::PointType m_OffsetTransformCenter, //LPS
InternalImageType::DirectionType m_IECtoLPSDirections
)
{
//itkImageProcessor::TransformType::Pointer
//itkImageProcessor::CalculateInternalTransform(
// ImageType3D::PointType m_TranslationOffset, //IEC
// ImageType3D::PointType m_RotationOffset, //IEC
// ImageType3D::PointType m_TranslationUser, //IEC
// ImageType3D::PointType m_RotationUser, //IEC
// ImageType3D::PointType m_ProjectionTransformCenter, //LPS
// ImageType3D::PointType m_UserTransformCenter, //LPS
// ImageType3D::PointType m_OffsetTransformCenter, //LPS
// InternalImageType::DirectionType m_IECtoLPSDirections
// )
//{
//Convert all inputs into LPS
// //Convert all inputs into LPS
ImageType3D::PointType m_TOffsetLPS =
m_IECtoLPSDirections * m_TranslationOffset;
// ImageType3D::PointType m_TOffsetLPS =
// m_IECtoLPSDirections * m_TranslationOffset;
ImageType3D::PointType m_ROffsetLPS =
m_IECtoLPSDirections * m_RotationOffset;
// ImageType3D::PointType m_ROffsetLPS =
// m_IECtoLPSDirections * m_RotationOffset;
ImageType3D::PointType m_TUserLPS =
m_IECtoLPSDirections * m_TranslationUser;
// ImageType3D::PointType m_TUserLPS =
// m_IECtoLPSDirections * m_TranslationUser;
ImageType3D::PointType m_RUserLPS =
m_IECtoLPSDirections * m_RotationUser;
// ImageType3D::PointType m_RUserLPS =
// m_IECtoLPSDirections * m_RotationUser;
// Map user to the projection center
TransformType::Pointer m_UserTransform =
MapTransformToNewOrigin (
m_ProjectionTransformCenter - m_UserTransformCenter,
m_TUserLPS,
m_RUserLPS
);
// // Map user to the projection center
// TransformType::Pointer m_UserTransform =
// MapTransformToNewOrigin (
// m_ProjectionTransformCenter - m_UserTransformCenter,
// m_TUserLPS,
// m_RUserLPS
// );
// Map offset to the projection center
TransformType::Pointer m_OffsetTransform =
MapTransformToNewOrigin (
m_ProjectionTransformCenter - m_UserTransformCenter,//m_OffsetTransformCenter,
m_TOffsetLPS,
m_ROffsetLPS
);
// // Map offset to the projection center
// TransformType::Pointer m_OffsetTransform =
// MapTransformToNewOrigin (
// m_ProjectionTransformCenter - m_UserTransformCenter,//m_OffsetTransformCenter,
// m_TOffsetLPS,
// m_ROffsetLPS
// );
TransformType::Pointer m_OutputTransform =
TransformType::New();
m_OutputTransform ->SetComputeZYX(true);
m_OutputTransform ->SetIdentity();
// TransformType::Pointer m_OutputTransform =
// TransformType::New();
// m_OutputTransform ->SetComputeZYX(true);
// m_OutputTransform ->SetIdentity();
m_OutputTransform->SetTranslation(
m_OffsetTransform->GetTranslation() +
m_UserTransform->GetTranslation()
);
// m_OutputTransform->SetTranslation(
// m_OffsetTransform->GetTranslation() +
// m_UserTransform->GetTranslation()
// );
m_OutputTransform->SetRotation(
m_OffsetTransform->GetAngleX() +
m_UserTransform->GetAngleX(),
m_OffsetTransform->GetAngleY() +
m_UserTransform->GetAngleY(),
m_OffsetTransform->GetAngleZ() +
m_UserTransform->GetAngleZ()
);
// m_OutputTransform->SetRotation(
// m_OffsetTransform->GetAngleX() +
// m_UserTransform->GetAngleX(),
// m_OffsetTransform->GetAngleY() +
// m_UserTransform->GetAngleY(),
// m_OffsetTransform->GetAngleZ() +
// m_UserTransform->GetAngleZ()
// );
m_OutputTransform->SetCenter(
m_ProjectionTransformCenter);
// m_OutputTransform->SetCenter(
// m_ProjectionTransformCenter);
//std::cout<<m_OutputTransform<<std::endl;
// std::cout<<m_OutputTransform<<std::endl;
return
m_OutputTransform;
}
// return
// m_OutputTransform;
//}
void itkImageProcessor::InitializeRegistration(
double stepLength,
@ -1599,43 +1575,51 @@ void itkImageProcessor::InitializeRegistration(
//ImageType3D::PointType pFakeIsoLPS =
// m_CTMetaInfo->GetProjectionOriginLPS(
// m_DRTGeometryMetaInfo->GetProjectionCenter1());
// CurrTransform =
// CalculateInternalTransform(
// ZeroPoint,
// ZeroPoint,
// m_TransformMetaInfo->GetTranslations(),
// m_TransformMetaInfo->GetRotations(),
// m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
// pFakeIsoLPS,
// ZeroPoint,
// IECtoLPS_Directions
// );
CurrTransform =
CalculateInternalTransform(
CalculateInternalTransformV2(
ZeroPoint,
ZeroPoint,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero(),
m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
pFakeIsoLPS,
ZeroPoint,
IECtoLPS_Directions
);
} else {
CurrTransform =
CalculateInternalTransform(
ZeroPoint ,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
m_CTMetaInfo->GetImportOffset(),
IECtoLPS_Directions
);
// CurrTransform =
// CalculateInternalTransform(
// ZeroPoint ,
// m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
// m_TransformMetaInfo->GetTranslations(),
// m_TransformMetaInfo->GetRotations(),
// m_CTMetaInfo->GetProjectionOriginLPS(
// m_DRTGeometryMetaInfo->GetProjectionCenter()
// ),
// m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
// m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
// m_CTMetaInfo->GetImportOffset(),
// IECtoLPS_Directions
// );
CurrTransform = CalculateInternalTransformV2(
ZeroPoint ,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetOriginLPS(),
IECtoLPS_Directions
);
}
@ -1651,9 +1635,6 @@ void itkImageProcessor::InitializeRegistration(
);
transform1->SetCenter(
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero() );
// transform1 ->SetCenter(
// m_CTMetaInfo->GetProjectionOriginLPSZero(
// m_DRTGeometryMetaInfo->GetProjectionCenter()));
/********* END OF CALCULATE INTERNAL TRANSFORM FOR PROJ1 *********/
@ -1670,43 +1651,51 @@ void itkImageProcessor::InitializeRegistration(
// CurrTransform =
// CalculateInternalTransform(
// ZeroPoint,
// ZeroPoint,
// m_TransformMetaInfo->GetTranslations(),
// m_TransformMetaInfo->GetRotations(),
// m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
// pFakeIsoLPS,
// ZeroPoint,
// IECtoLPS_Directions
// );
CurrTransform =
CalculateInternalTransform(
ZeroPoint,
ZeroPoint,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
pFakeIsoLPS,
ZeroPoint,
IECtoLPS_Directions
);
CalculateInternalTransformV2(
ZeroPoint,
ZeroPoint,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
IECtoLPS_Directions
);
} else {
CurrTransform =
CalculateInternalTransform(
ZeroPoint ,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
m_CTMetaInfo->GetImportOffset(),
IECtoLPS_Directions
);
// CurrTransform =
// CalculateInternalTransform(
// ZeroPoint ,
// m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
// m_TransformMetaInfo->GetTranslations(),
// m_TransformMetaInfo->GetRotations(),
// m_CTMetaInfo->GetProjectionOriginLPS(
// m_DRTGeometryMetaInfo->GetProjectionCenter()
// ),
// m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
// m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
// m_CTMetaInfo->GetImportOffset(),
// IECtoLPS_Directions
// );
CurrTransform = CalculateInternalTransformV2(
ZeroPoint,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetOriginLPS(),
IECtoLPS_Directions
);
}
transform2->SetComputeZYX(true);
@ -1720,9 +1709,6 @@ void itkImageProcessor::InitializeRegistration(
);
transform2->SetCenter(
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero() );
// transform2 ->SetCenter(
// m_CTMetaInfo->GetProjectionOriginLPSZero(
// m_DRTGeometryMetaInfo->GetProjectionCenter()));
/********* END OF CALCULATE INTERNAL TRANSFORM FOR PROJ1 *********/
@ -1963,16 +1949,17 @@ void itkImageProcessor::InitializeProjector()
// ZeroPoint,
// IECtoLPS_Directions
// );
CurrTransform = CalculateInternalTransformV2(
ZeroPoint ,
ZeroPoint ,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
IECtoLPS_Directions
);
ZeroPoint ,
ZeroPoint ,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero(),
m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
IECtoLPS_Directions
);
} else {
// CurrTransform =
@ -1997,27 +1984,25 @@ void itkImageProcessor::InitializeProjector()
IECtoLPS_Directions
);
}
// transform1->SetComputeZYX(true);
// transform1->SetIdentity();
transform1->SetComputeZYX(true);
transform1->SetIdentity();
// transform1->SetTranslation(
// CurrTransform->GetTranslation());
// transform1->SetRotation(
// CurrTransform->GetAngleX(),
// CurrTransform->GetAngleY(),
// CurrTransform->GetAngleZ()
// );
transform1->SetTranslation(
CurrTransform->GetTranslation());
transform1->SetRotation(
CurrTransform->GetAngleX(),
CurrTransform->GetAngleY(),
CurrTransform->GetAngleZ()
);
// transform1->SetCenter(
// m_DRTImage1MetaInfo->GetProjectionOriginLPSZero() );
transform1 = CurrTransform;
transform1->SetCenter(
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero() );
// transform1->Print(std::cout);
// 2D Image 1
interpolator1->SetProjectionAngle(
@ -2062,15 +2047,18 @@ void itkImageProcessor::InitializeProjector()
// ZeroPoint,
// IECtoLPS_Directions
// );
CurrTransform = CalculateInternalTransformV2(
ZeroPoint ,
ZeroPoint ,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
IECtoLPS_Directions
);
CurrTransform =
CalculateInternalTransformV2(
ZeroPoint,
ZeroPoint,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
IECtoLPS_Directions
);
} else {
// CurrTransform =
@ -2084,9 +2072,8 @@ void itkImageProcessor::InitializeProjector()
// m_CTMetaInfo->GetImportOffset(),
// IECtoLPS_Directions
// );
CurrTransform = CalculateInternalTransformV2(
ZeroPoint ,
ZeroPoint,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
@ -2094,27 +2081,25 @@ void itkImageProcessor::InitializeProjector()
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetOriginLPS(),
IECtoLPS_Directions
);
}
transform2 = CurrTransform;
// transform2->SetComputeZYX(true);
// transform2->SetIdentity();
// transform2->SetTranslation(
// CurrTransform->GetTranslation());
// transform2->SetRotation(
// CurrTransform->GetAngleX(),
// CurrTransform->GetAngleY(),
// CurrTransform->GetAngleZ()
// );
// transform2->SetCenter(
// m_DRTImage2MetaInfo->GetProjectionOriginLPSZero() );
// transform2 ->SetCenter(
// m_CTMetaInfo->GetProjectionOriginLPSZero(
// m_DRTGeometryMetaInfo->GetProjectionCenter()));
transform2->SetComputeZYX(true);
transform2->SetIdentity();
transform2->SetTranslation(
CurrTransform->GetTranslation());
transform2->SetRotation(
CurrTransform->GetAngleX(),
CurrTransform->GetAngleY(),
CurrTransform->GetAngleZ()
);
transform2->SetCenter(
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero() );
//transform2->Print(std::cout);
// 2D Image 2
@ -2346,11 +2331,11 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
IsocenterOffsetLPS = m_CTMetaInfo->ConvertIECPointToLPSPoint(
m_DRTGeometryMetaInfo->GetProjectionCenterOffset1());
// std::cout<< "///////////////// PGEOM META BEG ///////////////" <<std::endl;
// std::cout<<"NominalIsocenter IEC"<< m_DRTGeometryMetaInfo->GetProjectionCenter() <<std::endl;
// std::cout<<"CALIBRATION NominalIsocenter_wZcorrectionLPS "<<NominalIsocenter_wZcorrectionLPS<<std::endl;
// std::cout<<"CALIBRATION NominalIsocenterZero_wZcorrectionLPS "<<NominalIsocenterZero_wZcorrectionLPS<<std::endl;
// std::cout<<"CALIBRATION IsocenterOffsetLPS "<<IsocenterOffsetLPS<<std::endl;
std::cout<< "///////////////// PGEOM META BEG ///////////////" <<std::endl;
std::cout<<"NominalIsocenter IEC"<< m_DRTGeometryMetaInfo->GetProjectionCenter() <<std::endl;
std::cout<<"CALIBRATION NominalIsocenter_wZcorrectionLPS "<<NominalIsocenter_wZcorrectionLPS<<std::endl;
std::cout<<"CALIBRATION NominalIsocenterZero_wZcorrectionLPS "<<NominalIsocenterZero_wZcorrectionLPS<<std::endl;
std::cout<<"CALIBRATION IsocenterOffsetLPS "<<IsocenterOffsetLPS<<std::endl;
ImageType3D::PointType CalibratedIsocenterLPS;
@ -2361,7 +2346,7 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
CalibratedIsocenterLPS[2] = NominalIsocenter_wZcorrectionLPS[2] +
IsocenterOffsetLPS[2];
//std::cout<<"CALIBRATION CalibratedIsocenterLPS "<<CalibratedIsocenterLPS<<std::endl;
std::cout<<"CALIBRATION CalibratedIsocenterLPS "<<CalibratedIsocenterLPS<<std::endl;
ImageType3D::PointType CalibratedIsocenterZeroLPS;
@ -2371,7 +2356,7 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
IsocenterOffsetLPS[1];
CalibratedIsocenterZeroLPS[2] = NominalIsocenterZero_wZcorrectionLPS[2] +
IsocenterOffsetLPS[2];
//std::cout<<"CALIBRATION CalibratedIsocenterZeroLPS "<<CalibratedIsocenterZeroLPS<<std::endl;
std::cout<<"CALIBRATION CalibratedIsocenterZeroLPS "<<CalibratedIsocenterZeroLPS<<std::endl;
m_DRTImage1MetaInfo->SetProjectionAngleLPS(
this->CalcProjectionAngleLPS(
@ -2429,7 +2414,15 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
m_DRTGeometryMetaInfo->GetProjectionAngle1IEC() ),
//m_DRTGeometryMetaInfo->GetProjectionAngle1IEC(),// m_DRTImage1MetaInfo->GetProjectionAngleLPS(),
Std_DRT2LPS
)
) /*-
CalcDRTImageOffset(
PanelOffsetIEC1,
this->CalcProjectionAngleLPS(
m_CTMetaInfo->GetPatientOrientation(),
m_DRTGeometryMetaInfo->GetProjectionAngle1IEC() ),
Std_DRT2LPS
)*/
);
std::cout<<"CALIBRATION GetOriginLPS "<<m_DRTImage1MetaInfo->GetOriginLPS()<<std::endl;
@ -2684,6 +2677,18 @@ void itkImageProcessor::GetProjectionImages(){
// std::cout<<"pFakeIsoLPS: "<<std::endl;
// CurrTransform =
// CalculateInternalTransform(
// ZeroPoint,
// ZeroPoint,
// m_TransformMetaInfo->GetTranslations(),
// m_TransformMetaInfo->GetRotations(),
// m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
// pFakeIsoLPS,
// ZeroPoint,
// IECtoLPS_Directions
// );
CurrTransform =
CalculateInternalTransformV2(
ZeroPoint,
@ -2694,70 +2699,52 @@ void itkImageProcessor::GetProjectionImages(){
m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
IECtoLPS_Directions
);
} else {
// CurrTransform =
// CalculateInternalTransform(
// ZeroPoint ,
// m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
// m_TransformMetaInfo->GetTranslations(),
// m_TransformMetaInfo->GetRotations(),
// m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
// m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
// m_CTMetaInfo->GetImportOffset(),
// IECtoLPS_Directions
// );
// CurrTransform =
// CalculateInternalTransform(
// ZeroPoint ,
// m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
// m_TransformMetaInfo->GetTranslations(),
// m_TransformMetaInfo->GetRotations(),
// m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
// m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
// m_CTMetaInfo->GetImportOffset(),
// IECtoLPS_Directions
// );
CurrTransform = CalculateInternalTransformV2(
ZeroPoint ,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetOriginLPS(),
IECtoLPS_Directions
);
CurrTransform = CalculateInternalTransformV2(
ZeroPoint ,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetOriginLPS(),
IECtoLPS_Directions
);
}
std::cout<<m_DRTImage1MetaInfo->GetProjectionOriginLPSZero()<<std::endl;
std::cout<<m_RTMetaInfo->GetIsocenterLPS() <<std::endl;
std::cout<<m_CTMetaInfo->GetOriginLPS() <<std::endl;
std::cout<<m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetOriginLPS() <<std::endl;
std::cout<<"Curr GetCenter"<<CurrTransform->GetCenter()<<std::endl;
if(m_RTMetaInfo != NULL) std::cout<<"IsoCenter"<<m_RTMetaInfo->GetIsocenterLPS()<<std::endl;
}
transform1->SetComputeZYX(true);
transform1->SetIdentity();
// transform1->SetComputeZYX(true);
// transform1->SetIdentity();
// transform1->SetTranslation(
// CurrTransform->GetTranslation());
// transform1->SetRotation(
// CurrTransform->GetAngleX(),
// CurrTransform->GetAngleY(),
// CurrTransform->GetAngleZ()
// );
// transform1->SetCenter(
// m_DRTImage1MetaInfo->GetProjectionOriginLPSZero() );
transform1 = CurrTransform;
transform1->SetTranslation(
CurrTransform->GetTranslation());
transform1->SetRotation(
CurrTransform->GetAngleX(),
CurrTransform->GetAngleY(),
CurrTransform->GetAngleZ()
);
// std::cout<< "itkImageProcessor::GetProjectionImages" <<std::endl;
// AAAAAAA TODOOO CERCAA
// transform1 ->SetCenter(
// m_DRTImage1MetaInfo->GetProjectionOriginLPSZero());
// transform1 ->SetCenter(
// m_CTMetaInfo->GetProjectionOriginLPSZero(
// m_DRTGeometryMetaInfo->GetProjectionCenter()));
std::cout<<"----> transform1 GetCenter"<<transform1->GetCenter()<<std::endl;
transform1 ->SetCenter(
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero());
// std::cout<<"Angle1 "<<m_DRTImage1MetaInfo->GetProjectionAngleLPS() <<std::endl;
// std::cout<< "Origin1LPSZERO: "<<
@ -2796,17 +2783,27 @@ void itkImageProcessor::GetProjectionImages(){
// std::cout<<"pFakeIsoLPS: "<<std::endl;
// CurrTransform =
// CalculateInternalTransform(
// ZeroPoint,
// ZeroPoint,
// m_TransformMetaInfo->GetTranslations(),
// m_TransformMetaInfo->GetRotations(),
// m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
// pFakeIsoLPS,
// ZeroPoint,
// IECtoLPS_Directions
// );
CurrTransform =
CalculateInternalTransformV2(
ZeroPoint,
ZeroPoint,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
IECtoLPS_Directions
);
CalculateInternalTransformV2(
ZeroPoint,
ZeroPoint,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
IECtoLPS_Directions
);
// std::cout<<"pFakeIsoLPS: "<<std::endl;
@ -2825,7 +2822,7 @@ void itkImageProcessor::GetProjectionImages(){
// );
CurrTransform = CalculateInternalTransformV2(
ZeroPoint ,
ZeroPoint,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
@ -2833,27 +2830,27 @@ void itkImageProcessor::GetProjectionImages(){
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetOriginLPS(),
IECtoLPS_Directions
);
}
transform2 = CurrTransform;
// transform2->SetComputeZYX(true);
// transform2->SetIdentity();
// transform2->SetTranslation(
// CurrTransform->GetTranslation());
// transform2->SetRotation(
// CurrTransform->GetAngleX(),
// CurrTransform->GetAngleY(),
// CurrTransform->GetAngleZ()
// );
// transform2 ->SetCenter(
// m_DRTImage2MetaInfo->GetProjectionOriginLPSZero());
// transform2 ->SetCenter(
// m_CTMetaInfo->GetProjectionOriginLPSZero(
// m_DRTGeometryMetaInfo->GetProjectionCenter()));
transform2->SetComputeZYX(true);
transform2->SetIdentity();
transform2->SetTranslation(
CurrTransform->GetTranslation());
transform2->SetRotation(
CurrTransform->GetAngleX(),
CurrTransform->GetAngleY(),
CurrTransform->GetAngleZ()
);
transform2 ->SetCenter(
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero());
//transform2 ->Print(std::cout);

View File

@ -268,28 +268,30 @@ private:
void
CalculateExternalUserTransform(TransformType::Pointer transform, 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
);
// 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
// );
TransformType::Pointer
CalculateInternalTransformV2(
ImageType3D::PointType m_TranslationOffset,
ImageType3D::PointType m_RotationOffset,
ImageType3D::PointType m_TranslationUser,
ImageType3D::PointType m_RotationUser,
ImageType3D::PointType m_CalibratedProjectionCenter,
ImageType3D::PointType m_RTIsocenter,
InternalImageType::DirectionType m_IECtoLPSDirections
);
/* Calculate the transform used in siddon.
* The isocentric transform is mapped to the calibrated center of projection */
TransformType::Pointer
CalculateInternalTransformV2(
ImageType3D::PointType m_TranslationOffset,
ImageType3D::PointType m_RotationOffset,
ImageType3D::PointType m_TranslationUser,
ImageType3D::PointType m_RotationUser,
ImageType3D::PointType m_CalibratedProjectionCenter,
ImageType3D::PointType m_RTIsocenter,
InternalImageType::DirectionType m_IECtoLPSDirections
);
TransformType::Pointer