Calculate Transfrom for SRO isocetric mapped to pCT Zero.
This commit is contained in:
@ -102,12 +102,12 @@ MutualInformationTwoImageToOneImageMetric<TFixedImage, TMovingImage>::GetValue()
|
||||
}
|
||||
|
||||
|
||||
std::cout<< "----- itkMutualInformationTwoImage GetValue -----" <<std::endl;
|
||||
std::cout<< "Mutual GetValue T1 :: center : " <<
|
||||
this->m_Transform1.GetPointer()->GetCenter() <<std::endl;
|
||||
std::cout<< "Mutual GetValue T1 :: Pars : " <<
|
||||
this->m_Transform1.GetPointer()->GetParameters() <<std::endl;
|
||||
std::cout<< "--------------------------------" <<std::endl;
|
||||
// std::cout<< "----- itkMutualInformationTwoImage GetValue -----" <<std::endl;
|
||||
// std::cout<< "Mutual GetValue T1 :: center : " <<
|
||||
// this->m_Transform1.GetPointer()->GetCenter() <<std::endl;
|
||||
// std::cout<< "Mutual GetValue T1 :: Pars : " <<
|
||||
// this->m_Transform1.GetPointer()->GetParameters() <<std::endl;
|
||||
// std::cout<< "--------------------------------" <<std::endl;
|
||||
|
||||
this->m_Interpolator1->SetTransform(this->m_Transform1);
|
||||
this->m_Interpolator1->Initialize();
|
||||
@ -139,7 +139,7 @@ MutualInformationTwoImageToOneImageMetric<TFixedImage, TMovingImage>::GetValue()
|
||||
//metric1->SetFixedImageRegion(fixedImageRegion1);
|
||||
/* We get the fixed image region from the parent class... */
|
||||
metric1->SetFixedImageRegion(Superclass::GetFixedImageRegion1());
|
||||
std::cout<< "-----> Mutual :: fixedImageRegion1: "<< metric1->GetFixedImageRegion() << std::endl;
|
||||
//std::cout<< "-----> Mutual :: fixedImageRegion1: "<< metric1->GetFixedImageRegion() << std::endl;
|
||||
|
||||
auto movingImageRegion = this->m_Filter1->GetOutput()->GetBufferedRegion();
|
||||
unsigned int numberOfPixels = movingImageRegion.GetNumberOfPixels();
|
||||
@ -169,7 +169,7 @@ MutualInformationTwoImageToOneImageMetric<TFixedImage, TMovingImage>::GetValue()
|
||||
// auto fixedImageRegion2 = fixedImage2->GetBufferedRegion();
|
||||
// metric2->SetFixedImageRegion(fixedImageRegion2);
|
||||
metric2->SetFixedImageRegion(Superclass::GetFixedImageRegion2());
|
||||
std::cout<< "-----> Mutual :: fixedImageRegion2: "<< metric2->GetFixedImageRegion() << std::endl;
|
||||
//std::cout<< "-----> Mutual :: fixedImageRegion2: "<< metric2->GetFixedImageRegion() << std::endl;
|
||||
|
||||
movingImageRegion = this->m_Filter2->GetOutput()->GetBufferedRegion();
|
||||
numberOfPixels = movingImageRegion.GetNumberOfPixels();
|
||||
@ -191,13 +191,13 @@ MutualInformationTwoImageToOneImageMetric<TFixedImage, TMovingImage>::GetValue()
|
||||
|
||||
auto measure = (measure1 + measure2) / 2.0;
|
||||
|
||||
auto oldprecision = std::cout.precision();
|
||||
std::cout.precision(std::numeric_limits<double>::digits10 + 2);
|
||||
std::cout << "Measure1: " << measure1 << " Counts: " << this->m_NumberOfPixelsCounted << std::endl;
|
||||
std::cout << "Measure2: " << measure2 << " Counts: " << this->m_NumberOfPixelsCounted << std::endl;
|
||||
std::cout << "Measure: " << measure << std::endl;
|
||||
std::cout << "=======================================================" << std::endl;
|
||||
std::cout.precision(oldprecision);
|
||||
// auto oldprecision = std::cout.precision();
|
||||
// std::cout.precision(std::numeric_limits<double>::digits10 + 2);
|
||||
// std::cout << "Measure1: " << measure1 << " Counts: " << this->m_NumberOfPixelsCounted << std::endl;
|
||||
// std::cout << "Measure2: " << measure2 << " Counts: " << this->m_NumberOfPixelsCounted << std::endl;
|
||||
// std::cout << "Measure: " << measure << std::endl;
|
||||
// std::cout << "=======================================================" << std::endl;
|
||||
// std::cout.precision(oldprecision);
|
||||
return measure;
|
||||
}
|
||||
|
||||
|
@ -111,14 +111,14 @@ bool gTwoImageToOneImageMetric<TFixedImage, TMovingImage>::SetTransformParameter
|
||||
break;
|
||||
}
|
||||
|
||||
std::cout << "New Transform Parameters ISOC IEC = " << std::endl;
|
||||
std::cout << " Translation X = " << TranslationAlongX << " mm" << std::endl;
|
||||
std::cout << " Translation Y = " << TranslationAlongY << " mm" << std::endl;
|
||||
std::cout << " Translation Z = " << TranslationAlongZ << " mm" << std::endl;
|
||||
std::cout << " Rotation Along X = " << RotationAlongX /*/ dtr*/ << " deg" << std::endl;
|
||||
std::cout << " Rotation Along Y = " << RotationAlongY /*/ dtr*/ << " deg" << std::endl;
|
||||
std::cout << " Rotation Along Z = " << RotationAlongZ /*/ dtr*/ << " deg" << std::endl;
|
||||
std::cout << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
|
||||
// std::cout << "New Transform Parameters ISOC IEC = " << std::endl;
|
||||
// std::cout << " Translation X = " << TranslationAlongX << " mm" << std::endl;
|
||||
// std::cout << " Translation Y = " << TranslationAlongY << " mm" << std::endl;
|
||||
// std::cout << " Translation Z = " << TranslationAlongZ << " mm" << std::endl;
|
||||
// std::cout << " Rotation Along X = " << RotationAlongX /*/ dtr*/ << " deg" << std::endl;
|
||||
// std::cout << " Rotation Along Y = " << RotationAlongY /*/ dtr*/ << " deg" << std::endl;
|
||||
// std::cout << " Rotation Along Z = " << RotationAlongZ /*/ dtr*/ << " deg" << std::endl;
|
||||
// std::cout << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
|
||||
|
||||
|
||||
// individual R and T components of the IsoC transform
|
||||
@ -162,10 +162,10 @@ bool gTwoImageToOneImageMetric<TFixedImage, TMovingImage>::SetTransformParameter
|
||||
m_Transform1->SetCenter(
|
||||
m_internalMeta1->GetpCalProjCenter());
|
||||
|
||||
std::cout<<"----- itkgTwoImageToOne SetTransformParameters -----"<<std::endl;
|
||||
std::cout << "m_Transform1 :: Center: "<< m_Transform1->GetCenter()<<std::endl;
|
||||
std::cout << "m_Transform1 :: Pars: "<< m_Transform1->GetParameters()<<std::endl;
|
||||
std::cout<< "--------------------------------" <<std::endl;
|
||||
// std::cout<<"----- itkgTwoImageToOne SetTransformParameters -----"<<std::endl;
|
||||
// std::cout << "m_Transform1 :: Center: "<< m_Transform1->GetCenter()<<std::endl;
|
||||
// std::cout << "m_Transform1 :: Pars: "<< m_Transform1->GetParameters()<<std::endl;
|
||||
// std::cout<< "--------------------------------" <<std::endl;
|
||||
|
||||
|
||||
// Calculate internal transform2
|
||||
|
@ -2184,7 +2184,7 @@ void itkImageProcessor::GetProjectionImages(){
|
||||
return;
|
||||
}
|
||||
|
||||
const double dtr = (atan(1.0) * 4.0) / 180.0;
|
||||
// const double dtr = (atan(1.0) * 4.0) / 180.0;
|
||||
|
||||
ImageType3D::PointType ZeroPoint;
|
||||
ZeroPoint.Fill(0.);
|
||||
@ -2215,15 +2215,15 @@ void itkImageProcessor::GetProjectionImages(){
|
||||
transform1 ->SetCenter(
|
||||
m_DRTImage1MetaInfo->GetProjectionOriginLPSZero());
|
||||
|
||||
std::cout<< "CurrTransform Rotations: "<<
|
||||
CurrTransform->GetAngleX() <<" "<<
|
||||
CurrTransform->GetAngleY() <<" "<<
|
||||
CurrTransform->GetAngleZ() <<" "<< std::endl;
|
||||
// std::cout<< "CurrTransform Rotations: "<<
|
||||
// CurrTransform->GetAngleX() <<" "<<
|
||||
// CurrTransform->GetAngleY() <<" "<<
|
||||
// CurrTransform->GetAngleZ() <<" "<< std::endl;
|
||||
|
||||
std::cout<< "CurrTransform Translations: "<<
|
||||
CurrTransform->GetTranslation()<<std::endl;
|
||||
std::cout<< "CurrTransform center: "<<
|
||||
CurrTransform->GetCenter()<<std::endl;
|
||||
// std::cout<< "CurrTransform Translations: "<<
|
||||
// CurrTransform->GetTranslation()<<std::endl;
|
||||
// std::cout<< "CurrTransform center: "<<
|
||||
// CurrTransform->GetCenter()<<std::endl;
|
||||
|
||||
|
||||
//transform1 ->Print(std::cout);
|
||||
@ -2823,7 +2823,7 @@ itkImageProcessor::GetUserIsocentricTransform(){
|
||||
|
||||
TransformType::Pointer
|
||||
itkImageProcessor::GetCompleteIsocentricTransform
|
||||
(ImageType3D::PointType TransformCenter){
|
||||
(/*ImageType3D::PointType TransformCenter*/){
|
||||
|
||||
TransformType::Pointer
|
||||
regTransform = TransformType::New();
|
||||
@ -2851,6 +2851,38 @@ itkImageProcessor::GetCompleteIsocentricTransform
|
||||
m_CTMetaInfo->GetImportOffset()[2]<<" "<<std::endl;
|
||||
std::cout<<" --- --- --- "<<std::endl;
|
||||
|
||||
ImageType3D::PointType mISORTIEC =
|
||||
m_CTMetaInfo->GetLPS2IECDirections() * m_RTMetaInfo->GetIsocenterLPS();
|
||||
|
||||
mISORTIEC[0] *= -1;
|
||||
mISORTIEC[1] *= -1;
|
||||
mISORTIEC[2] *= -1;
|
||||
|
||||
TransformType::Pointer mTransf=
|
||||
MapTransformToNewOrigin(
|
||||
mISORTIEC,
|
||||
m_TransformMetaInfo->GetT(),
|
||||
m_TransformMetaInfo->GetR()
|
||||
);
|
||||
|
||||
itk::TransformMetaInformation::PointType
|
||||
pTM = m_CTMetaInfo->GetLPS2IECDirections() * m_CTMetaInfo->GetImportOffset();
|
||||
|
||||
TransformType::OutputVectorType pTransl;
|
||||
|
||||
pTransl[0] = mTransf->GetTranslation()[0] - pTM[0];
|
||||
pTransl[1] = mTransf->GetTranslation()[1] - pTM[1];
|
||||
pTransl[2] = mTransf->GetTranslation()[2] - pTM[2];
|
||||
|
||||
mTransf->SetTranslation(pTransl);
|
||||
itk::Point<double,3>pZero;
|
||||
pZero.Fill(0.);
|
||||
mTransf->SetCenter(pZero);
|
||||
|
||||
std::cout<<"mTransf R"<< mTransf->GetMatrix().GetVnlMatrix() << std::endl;
|
||||
std::cout<<"mTransf T"<< mTransf->GetTranslation() << std::endl;
|
||||
|
||||
return mTransf;
|
||||
}
|
||||
|
||||
|
||||
|
@ -165,7 +165,7 @@ public:
|
||||
* in Isocentric transform with center at the RT Iso.
|
||||
*/
|
||||
TransformType::Pointer
|
||||
GetCompleteIsocentricTransform(ImageType3D::PointType TransformCenter);
|
||||
GetCompleteIsocentricTransform(/*ImageType3D::PointType TransformCenter*/);
|
||||
|
||||
/** Get only the User component of the transform
|
||||
* as parameters' list */
|
||||
@ -286,12 +286,6 @@ private:
|
||||
/** ITK to VTK filter */
|
||||
using ITKtoVTKFilterType = itk::ImageToVTKImageFilter<OutputImageType>;
|
||||
|
||||
// void
|
||||
// CalculateExternalUserTransform(
|
||||
// TransformType::Pointer transform,
|
||||
// DRTImageMetaInformation::Pointer imageMetaInfo);
|
||||
|
||||
|
||||
TransformType::Pointer
|
||||
transform1,
|
||||
transform2,
|
||||
|
Reference in New Issue
Block a user