Merge branch 'ScoutRTUIDevel' into 'scoutRTUIDevelTemp'

# Conflicts:
#   itkDTRrecon/itkImageProcessor.cpp
This commit is contained in:
2023-05-03 14:14:16 +00:00
3 changed files with 138 additions and 317 deletions

View File

@@ -1443,14 +1443,13 @@ itkImageProcessor::CalculateInternalTransformV2(
}
itkImageProcessor::TransformType::Pointer
itkImageProcessor::CalculateInternalTransform(
itkImageProcessor::CalculateInternalTransformV2(
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
ImageType3D::PointType m_CalibratedProjectionCenter, //LPS
ImageType3D::PointType m_RTIsocenter, //LPS
InternalImageType::DirectionType m_IECtoLPSDirections
)
{
@@ -1469,51 +1468,31 @@ itkImageProcessor::CalculateInternalTransform(
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
);
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];
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];
// Map offset to the projection center
TransformType::Pointer m_OffsetTransform =
TransformType::Pointer m_outputTransform =
MapTransformToNewOrigin (
m_ProjectionTransformCenter - m_UserTransformCenter,
m_TOffsetLPS,
m_ROffsetLPS
m_CalibratedProjectionCenter - m_RTIsocenter,
translation,
rotations
);
TransformType::Pointer m_OutputTransform =
TransformType::New();
m_OutputTransform ->SetComputeZYX(true);
m_OutputTransform ->SetIdentity();
m_outputTransform->SetCenter(m_CalibratedProjectionCenter);
m_OutputTransform->SetTranslation(
m_OffsetTransform->GetTranslation() +
m_UserTransform->GetTranslation()
);
return m_outputTransform;
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);
//std::cout<<m_OutputTransform<<std::endl;
return
m_OutputTransform;
}
void itkImageProcessor::InitializeRegistration(
double stepLength,
double maxTranslation,
@@ -1599,31 +1578,27 @@ void itkImageProcessor::InitializeRegistration(
//AAAAAA TODOOOOO CERCA
ImageType3D::PointType pFakeIsoLPS =
m_DRTImage1MetaInfo->GetProjectionOriginLPS();
//ImageType3D::PointType pFakeIsoLPS =
// m_CTMetaInfo->GetProjectionOriginLPS(
// m_DRTGeometryMetaInfo->GetProjectionCenter1());
CurrTransform =
CalculateInternalTransform(
CalculateInternalTransformV2(
ZeroPoint,
ZeroPoint,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero(),
m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
pFakeIsoLPS,
ZeroPoint,
IECtoLPS_Directions
);
} else {
CurrTransform =
CalculateInternalTransform(
CurrTransform = CalculateInternalTransformV2(
ZeroPoint ,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
m_CTMetaInfo->GetImportOffset(),
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetOriginLPS(),
IECtoLPS_Directions
);
@@ -1641,6 +1616,7 @@ void itkImageProcessor::InitializeRegistration(
);
transform1->SetCenter(
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero() );
/********* END OF CALCULATE INTERNAL TRANSFORM FOR PROJ1 *********/
@@ -1651,37 +1627,31 @@ void itkImageProcessor::InitializeRegistration(
ImageType3D::PointType pFakeIsoLPS =
m_DRTImage2MetaInfo->GetProjectionOriginLPS();
//ImageType3D::PointType pFakeIsoLPS =
// m_CTMetaInfo->GetProjectionOriginLPS(
// m_DRTGeometryMetaInfo->GetProjectionCenter2());
CurrTransform =
CalculateInternalTransformV2(
ZeroPoint,
ZeroPoint,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
IECtoLPS_Directions
);
CurrTransform =
CalculateInternalTransform(
ZeroPoint,
ZeroPoint,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
pFakeIsoLPS,
ZeroPoint,
IECtoLPS_Directions
);
} else {
CurrTransform =
CalculateInternalTransform(
ZeroPoint ,
CurrTransform = CalculateInternalTransformV2(
ZeroPoint,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
m_CTMetaInfo->GetImportOffset(),
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetOriginLPS(),
IECtoLPS_Directions
);
}
transform2->SetComputeZYX(true);
transform2->SetIdentity();
@@ -1912,35 +1882,30 @@ void itkImageProcessor::InitializeProjector()
if(m_RTMetaInfo == NULL)
{
//AAAAAA TODOOOOO CERCA
ImageType3D::PointType pFakeIsoLPS =
m_DRTImage1MetaInfo->GetProjectionOriginLPS();
CurrTransform = CalculateInternalTransformV2(
ZeroPoint ,
ZeroPoint ,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero(),
m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
IECtoLPS_Directions
);
CurrTransform =
CalculateInternalTransform(
ZeroPoint,
ZeroPoint,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
pFakeIsoLPS,
ZeroPoint,
IECtoLPS_Directions
);
} else {
} else {
CurrTransform =
CalculateInternalTransform(
CurrTransform = CalculateInternalTransformV2(
ZeroPoint ,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
m_CTMetaInfo->GetImportOffset(),
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetOriginLPS(),
IECtoLPS_Directions
);
}
@@ -1955,10 +1920,9 @@ void itkImageProcessor::InitializeProjector()
CurrTransform->GetAngleZ()
);
transform1->SetCenter(
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero() );
// transform1->Print(std::cout);
// 2D Image 1
interpolator1->SetProjectionAngle(
@@ -1969,54 +1933,36 @@ void itkImageProcessor::InitializeProjector()
m_DRTGeometryMetaInfo->GetIntensityThreshold() );
interpolator1->SetPanelOffset(
m_DRTGeometryMetaInfo->GetPanel1Offset());
std::cout<<
"00000000000000 IP1 m_DRTGeometryMetaInfo->GetPanel2Offset()"
<<m_DRTGeometryMetaInfo->GetPanel1Offset()<<std::endl;
interpolator1->SetTransform(transform1);
interpolator1->Initialize();
//CurrTransform->SetComputeZYX(true);
//CurrTransform->SetIdentity();
if(m_RTMetaInfo == NULL)
{
ImageType3D::PointType pFakeIsoLPS =
m_DRTImage2MetaInfo->GetProjectionOriginLPS();
//ImageType3D::PointType pFakeIsoLPS =
// m_CTMetaInfo->GetProjectionOriginLPS(
// m_DRTGeometryMetaInfo->GetProjectionCenter2());
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 ,
CurrTransform = CalculateInternalTransformV2(
ZeroPoint,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
m_CTMetaInfo->GetImportOffset(),
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetOriginLPS(),
IECtoLPS_Directions
);
}
@@ -2045,25 +1991,10 @@ void itkImageProcessor::InitializeProjector()
m_DRTGeometryMetaInfo->GetIntensityThreshold() );
interpolator2->SetPanelOffset(
m_DRTGeometryMetaInfo->GetPanel2Offset());
std::cout<<
"00000000000000 IP2 m_DRTGeometryMetaInfo->GetPanel2Offset()"
<<m_DRTGeometryMetaInfo->GetPanel2Offset()<<std::endl;
interpolator2->SetTransform(transform2);
interpolator2->Initialize();
// // 2D Image 2
// interpolator2->SetProjectionAngle(
// dtr *
// m_DRTImage2MetaInfo->GetProjectionAngleLPS() );
// interpolator2->SetFocalPointToIsocenterDistance(
// m_DRTImage2MetaInfo->GetSCD());
// interpolator2->SetThreshold(
// m_DRTGeometryMetaInfo->GetIntensityThreshold()
// );
// interpolator2->SetTransform(transform);
// interpolator2->Initialize();
resampleFilter1 = ResampleFilterType::New();
resampleFilter1->SetInput(
@@ -2216,9 +2147,6 @@ void itkImageProcessor::loadRTPlanInfo(
);
// std::cout<< "m_CTMetaInfo->GetImportOffset() "
// <<m_CTMetaInfo->GetImportOffset() <<std::endl;
this->UpdateProjectionGeometryMeta();
this->InitializeProjector();
@@ -2265,11 +2193,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;
@@ -2280,7 +2208,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;
@@ -2290,7 +2218,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(
@@ -2328,16 +2256,15 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
CalcDRTImageOrigin(
m_DRTImage1MetaInfo->GetOrigin(),
m_DRTImage1MetaInfo->GetCOV(),
NominalIsocenter_wZcorrectionLPS,
NominalIsocenter_wZcorrectionLPS,//m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
this->CalcProjectionAngleLPS(
m_CTMetaInfo->GetPatientOrientation(),
m_DRTGeometryMetaInfo->GetProjectionAngle1IEC() ),
//m_DRTGeometryMetaInfo->GetProjectionAngle1IEC(),// m_DRTImage1MetaInfo->GetProjectionAngleLPS(),
Std_DRT2LPS
)
);
std::cout<<"CALIBRATION GetOriginLPS "<<m_DRTImage1MetaInfo->GetOriginLPS()<<std::endl;
m_DRTImage1MetaInfo->SetImageDirectionsLPS(
CalcDRTImageDirections(
@@ -2348,24 +2275,6 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
Std_DRT2LPS)
);
// std::cout<<"IsocenterOffsetLPS"<< IsocenterOffsetLPS <<std::endl;
// std::cout<<"CalibratedIsocenterLPS"<< CalibratedIsocenterLPS <<std::endl;
// std::cout<<"CalibratedIsocenterZeroLPS"<< CalibratedIsocenterZeroLPS <<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetSize()"<< m_DRTImage1MetaInfo->GetSize() <<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetSpacing()"<< m_DRTImage1MetaInfo->GetSpacing() <<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetOrigin()"<< m_DRTImage1MetaInfo->GetOrigin() <<std::endl;
// std::cout<<"CalcDRTImageOffset1"<< CalcDRTImageOffset(
// PanelOffsetIEC1,
// this->CalcProjectionAngleLPS(
// m_CTMetaInfo->GetPatientOrientation(),
// m_DRTGeometryMetaInfo->GetProjectionAngle1IEC() ),
// Std_DRT2LPS
// ) <<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetCOV()"<< m_DRTImage1MetaInfo->GetCOV() <<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetOriginLPS()"<< m_DRTImage1MetaInfo->GetOriginLPS() <<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetProjectionAngleLPS()"<<m_DRTImage1MetaInfo->GetProjectionAngleLPS()<<std::endl;
// std::cout<<"m_DRTImage1MetaInfo->GetImageDirectionsLPS()"<< m_DRTImage1MetaInfo->GetImageDirectionsLPS() <<std::endl;
// SECOND
@@ -2407,6 +2316,7 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
m_DRTImage2MetaInfo->SetProjectionOriginLPSZero(
CalibratedIsocenterZeroLPS);
m_DRTImage2MetaInfo->SetSizeWithBounds(
NULL,//vBounds.data(),
m_DRTGeometryMetaInfo->GetDRT2Size(),
@@ -2433,8 +2343,6 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
Std_DRT2LPS
));
std::cout<<"m_DRTImage2MetaInfo->GetOriginLPS()"<< m_DRTImage2MetaInfo->GetOriginLPS() <<std::endl;
m_DRTImage2MetaInfo->SetOriginLPS(
CalcDRTImageOrigin(
@@ -2459,26 +2367,6 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
Std_DRT2LPS)
);
// std::cout<<"IsocenterOffsetLPS"<< IsocenterOffsetLPS <<std::endl;
// std::cout<<"CalibratedIsocenterLPS"<< CalibratedIsocenterLPS <<std::endl;
// std::cout<<"CalibratedIsocenterZeroLPS"<< CalibratedIsocenterZeroLPS <<std::endl;
// std::cout<<"m_DRTImage2MetaInfo->GetSize()"<< m_DRTImage2MetaInfo->GetSize() <<std::endl;
// std::cout<<"m_DRTImage2MetaInfo->GetSpacing()"<< m_DRTImage2MetaInfo->GetSpacing() <<std::endl;
// std::cout<<"m_DRTImage2MetaInfo->GetOrigin()"<< m_DRTImage2MetaInfo->GetOrigin() <<std::endl;
// std::cout<<"CalcDRTImageOffset2"<< CalcDRTImageOffset(
// PanelOffsetIEC2,
// this->CalcProjectionAngleLPS(
// m_CTMetaInfo->GetPatientOrientation(),
// m_DRTGeometryMetaInfo->GetProjectionAngle2IEC() ),
// Std_DRT2LPS
// ) <<std::endl;
// std::cout<<"m_DRTImage2MetaInfo->GetCOV()"<< m_DRTImage2MetaInfo->GetCOV() <<std::endl;
std::cout<<"m_DRTImage2MetaInfo->GetOriginLPS() - Offset "<< m_DRTImage2MetaInfo->GetOriginLPS() <<std::endl;
// std::cout<<"m_DRTImage2MetaInfo->GetProjectionAngleLPS()"<<m_DRTImage2MetaInfo->GetProjectionAngleLPS()<<std::endl;
// std::cout<<"m_DRTImage2MetaInfo->GetImageDirectionsLPS()"<< m_DRTImage2MetaInfo->GetImageDirectionsLPS() <<std::endl;
}
@@ -2507,22 +2395,6 @@ itkImageProcessor::CalcDRTImageOrigin(
NewOrigin;
}
//itkImageProcessor::ImageType3D::PointType
//itkImageProcessor::CalcDRTImageOffset(
// ImageType3D::PointType m_DRTOffset,
// double dAngle,
// InternalImageType::DirectionType stdDRT2LPS
// ){
// itkImageProcessor::InternalImageType::DirectionType DRT2LPS
// = this->CalcDRTImageDirections(dAngle, stdDRT2LPS);
// ImageType3D::PointType NewOffset =
// DRT2LPS * (m_DRTOffset);
// return
// NewOffset;
//}
void itkImageProcessor::GetProjectionImages(){
@@ -2549,48 +2421,35 @@ void itkImageProcessor::GetProjectionImages(){
IECtoLPS_Directions =
m_CTMetaInfo->GetLPS2IECDirections().GetTranspose();
TransformType::Pointer CurrTransform;
//CurrTransform->SetComputeZYX(true);
//CurrTransform->SetIdentity();
if(m_RTMetaInfo == NULL)
{
ImageType3D::PointType pFakeIsoLPS =
m_DRTImage1MetaInfo->GetProjectionOriginLPS();
//m_CTMetaInfo->GetProjectionOriginLPS(
// m_DRTGeometryMetaInfo->GetProjectionCenter());
// std::cout<<"pFakeIsoLPS: "<<std::endl;
CurrTransform =
CalculateInternalTransform(
CalculateInternalTransformV2(
ZeroPoint,
ZeroPoint,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero(),
m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
pFakeIsoLPS,
ZeroPoint,
IECtoLPS_Directions
);
} else {
CurrTransform =
CalculateInternalTransform(
CurrTransform = CalculateInternalTransformV2(
ZeroPoint ,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
m_CTMetaInfo->GetImportOffset(),
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetOriginLPS(),
IECtoLPS_Directions
);
}
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();
@@ -2602,22 +2461,9 @@ void itkImageProcessor::GetProjectionImages(){
CurrTransform->GetAngleY(),
CurrTransform->GetAngleZ()
);
// std::cout<< "itkImageProcessor::GetProjectionImages" <<std::endl;
// AAAAAAA TODOOO CERCAA
transform1 ->SetCenter(
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero());
// std::cout<<"Angle1 "<<m_DRTImage1MetaInfo->GetProjectionAngleLPS() <<std::endl;
// std::cout<< "Origin1LPSZERO: "<<
// m_DRTImage1MetaInfo->GetProjectionOriginLPSZero() <<std::endl;
// std::cout<<"Origin1LPS: "<< m_DRTImage1MetaInfo->GetProjectionOriginLPS()<<std::endl;
// std::cout<<"Angle2 "<<m_DRTImage2MetaInfo->GetProjectionAngleLPS() <<std::endl;
// std::cout<< "Origin2LPSZERO: "<<
// m_DRTImage2MetaInfo->GetProjectionOriginLPSZero() <<std::endl;
// std::cout<<"Origin2LPS: "<< m_DRTImage2MetaInfo->GetProjectionOriginLPS()<<std::endl;
//transform1 ->Print(std::cout);
// The parameters of interpolator1, such as ProjectionAngle and FocalPointToIsocenterDistance
@@ -2627,61 +2473,37 @@ void itkImageProcessor::GetProjectionImages(){
interpolator1->Initialize();
transform2->SetComputeZYX(true);
transform2->SetIdentity();
//CurrTransform->SetComputeZYX(true);
//CurrTransform->SetIdentity();
if(m_RTMetaInfo == NULL)
{
ImageType3D::PointType pFakeIsoLPS =
m_DRTImage2MetaInfo->GetProjectionOriginLPS();
//m_CTMetaInfo->GetProjectionOriginLPS(
// m_DRTGeometryMetaInfo->GetProjectionCenter());
// std::cout<<"pFakeIsoLPS: "<<std::endl;
CurrTransform =
CalculateInternalTransform(
ZeroPoint,
ZeroPoint,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
pFakeIsoLPS,
ZeroPoint,
IECtoLPS_Directions
);
// std::cout<<"pFakeIsoLPS: "<<std::endl;
CalculateInternalTransformV2(
ZeroPoint,
ZeroPoint,
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
IECtoLPS_Directions
);
} else {
CurrTransform =
CalculateInternalTransform(
ZeroPoint ,
CurrTransform = CalculateInternalTransformV2(
ZeroPoint,
m_DRTGeometryMetaInfo->GetIECS2IECScannerR(),
m_TransformMetaInfo->GetTranslations(),
m_TransformMetaInfo->GetRotations(),
m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset(),
m_CTMetaInfo->GetImportOffset(),
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero(),
m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetOriginLPS(),
IECtoLPS_Directions
);
std::cout<<"GGGG CalculateInternalTransform GGG"<<std::endl;
std::cout<<m_DRTGeometryMetaInfo->GetIECS2IECScannerR()<<std::endl;
std::cout<<m_TransformMetaInfo->GetTranslations()<<std::endl;
std::cout<<m_TransformMetaInfo->GetRotations()<<std::endl;
std::cout<<m_DRTImage2MetaInfo->GetProjectionOriginLPS()<<std::endl;
std::cout<<m_RTMetaInfo->GetIsocenterLPS()<<std::endl;
std::cout<<m_CTMetaInfo->GetImportOffset()<<std::endl;
std::cout<<m_RTMetaInfo->GetIsocenterLPS() - m_CTMetaInfo->GetImportOffset()<<std::endl;
std::cout<< m_CTMetaInfo->GetImportOffset() <<std::endl;
}
@@ -2697,34 +2519,21 @@ void itkImageProcessor::GetProjectionImages(){
CurrTransform->GetAngleZ()
);
transform2 ->SetCenter(
m_DRTImage2MetaInfo->GetProjectionOriginLPSZero());
//transform2 ->Print(std::cout);
// // The parameters of interpolator2, such as ProjectionAngle and FocalPointToIsocenterDistance
// // have been set before registration. Here we only need to replace the initial
// // transform with the final transform.
interpolator2->SetTransform(transform2); //finalTransform);
interpolator2->Initialize();
// std::cout<<"pFakeIsoLPS: "<<std::endl;
filter1->Update();
filter2->Update();
imageDRT1In = filter1->GetOutput();
imageDRT2In = filter2->GetOutput();
// std::cout<< "itkImageProcessor::GetProjectionImages END" <<std::endl;
// std::cout<<"MMMMM: "<<
// interpolator1->GetInverseTransform()->GetMatrix()<<std::endl;
// std::cout<<"MMMMM: "<<
// interpolator1->GetInverseTransform()->GetTranslation()<<std::endl;
}
@@ -3140,13 +2949,12 @@ vtkImageData* itkImageProcessor::GetProjection2VTK()
double* dBounds = toVTK2D2->GetOutput()->GetBounds();
std::cout<< "-------- Proj 2 --------" <<std::endl;
std::cout<<"Bounds: "<<dBounds[0]<<" "<<dBounds[1]<<" "
<<dBounds[2]<<" "<<dBounds[3]<<" "
<<dBounds[4]<<" "<<dBounds[5]<<std::endl;
std::cout<< "-------- -------- --------" <<std::endl;
//double* dBounds = toVTK2D2->GetOutput()->GetBounds();
// std::cout<< "-------- Proj 2 --------" <<std::endl;
// std::cout<<"Bounds: "<<dBounds[0]<<" "<<dBounds[1]<<" "
// <<dBounds[2]<<" "<<dBounds[3]<<" "
// <<dBounds[4]<<" "<<dBounds[5]<<std::endl;
// std::cout<< "-------- -------- --------" <<std::endl;
return
toVTK2D2->GetOutput();

View File

@@ -269,17 +269,30 @@ private:
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
// );
/* 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
CalculateInternalTransformV2(

View File

@@ -97,7 +97,7 @@ public:
Execute(const itk::Object* object, const itk::EventObject& event) override
{
if(objIterUpdate->getAbortFlag()){
std::cout << "Abortisci per piacere" << std::endl;
std::cout << "AbortRequest" << std::endl;
objIterUpdate->setAbortFlag(false);
throw itk::ProcessAborted();
}