Major modifications to account for introducing in the calibration paramters the panel center offset:

This include as most important changes:
- itkImageProcessor UpdateProjectionGeometryMeta - SetOriginLPS now includes that offset
- ui_qvtk_handler: change in overlapping of two images. This now use the vtk provided image center which also consider image orientation and allows us to work under no assumption of center at same position between DRT and TOPO
This release was tested on Imaging calibration data. Consistency was good. On Phantom data also good consistency on Correction Vector between SHORT and LONG
This commit is contained in:
Proton local user
2023-04-28 18:51:28 +02:00
parent 6af205e60e
commit 292032fca2
4 changed files with 156 additions and 33 deletions

View File

@ -450,6 +450,10 @@ DRTProjectionGeometryImageMetaInformation(){
this->m_SCD2Offset = 0.;
this->m_Panel1Offset = 0.;
this->m_Panel2Offset = 0.;
this->m_IntensityThreshold=0.;
this->m_DRT1Size.Fill(0.);

View File

@ -372,6 +372,12 @@ public:
itkSetMacro(SCD2Offset, double);
itkGetMacro(SCD2Offset, double);
itkSetMacro(Panel1Offset, double);
itkGetMacro(Panel1Offset, double);
itkSetMacro(Panel2Offset, double);
itkGetMacro(Panel2Offset, double);
itkSetMacro(IntensityThreshold, double);
itkGetMacro(IntensityThreshold, double);
@ -413,6 +419,8 @@ protected:
m_SCD2,
m_SCD1Offset,
m_SCD2Offset,
m_Panel1Offset,
m_Panel2Offset,
m_IntensityThreshold;

View File

@ -261,9 +261,27 @@ double itkImageProcessor::GetSCD1(){
}
double itkImageProcessor::GetSCD2(){
return
m_DRTImage1MetaInfo ->GetSCD();
m_DRTImage2MetaInfo ->GetSCD();
}
void itkImageProcessor::SetPanelOffsets(double dOff1, double dOff2)
{
m_DRTGeometryMetaInfo->SetPanel1Offset(dOff1);
m_DRTGeometryMetaInfo->SetPanel2Offset(dOff2);
}
double itkImageProcessor::GetPanelOffset1(){
return
m_DRTGeometryMetaInfo->GetPanel1Offset();
}
double itkImageProcessor::GetPanelOffset2(){
return
m_DRTGeometryMetaInfo ->GetPanel2Offset();
}
void itkImageProcessor::SetDegreeOfFreedom(tDegreeOfFreedomEnum dof)
{
m_TransformMetaInfo->SetDegreeOfFreedom(dof);
@ -2020,7 +2038,7 @@ void itkImageProcessor::InitializeProjector()
filter2->SetInput( resampleFilter2 ->GetOutput() );
filter2->SetOutputDirection(m_DRTImage2MetaInfo->GetImageDirectionsLPS() );
filter2->ChangeDirectionOn();
filter2->SetOutputOrigin(m_DRTImage2MetaInfo->GetOriginLPS() );
filter2->SetOutputOrigin(m_DRTImage2MetaInfo->GetOriginLPS() );
filter2->ChangeOriginOn();
filter2->UpdateOutputInformation();
@ -2160,11 +2178,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;
@ -2175,6 +2193,7 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
CalibratedIsocenterLPS[2] = NominalIsocenter_wZcorrectionLPS[2] +
IsocenterOffsetLPS[2];
std::cout<<"CALIBRATION CalibratedIsocenterLPS "<<CalibratedIsocenterLPS<<std::endl;
ImageType3D::PointType CalibratedIsocenterZeroLPS;
@ -2184,6 +2203,7 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
IsocenterOffsetLPS[1];
CalibratedIsocenterZeroLPS[2] = NominalIsocenterZero_wZcorrectionLPS[2] +
IsocenterOffsetLPS[2];
std::cout<<"CALIBRATION CalibratedIsocenterZeroLPS "<<CalibratedIsocenterZeroLPS<<std::endl;
m_DRTImage1MetaInfo->SetProjectionAngleLPS(
this->CalcProjectionAngleLPS(
@ -2203,27 +2223,33 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
m_DRTImage1MetaInfo->SetProjectionOriginLPSZero(
CalibratedIsocenterZeroLPS);
// This is based on the calibrated iso to be sure...
std::vector <double> vBounds = m_CTMetaInfo->CalculateRegions(
NominalIsocenter_wZcorrectionLPS
// m_DRTImage1MetaInfo->GetProjectionOriginLPS()
);
// // This is based on the calibrated iso to be sure...
// std::vector <double> vBounds = m_CTMetaInfo->CalculateRegions(
// NominalIsocenter_wZcorrectionLPS
//// m_DRTImage1MetaInfo->GetProjectionOriginLPS()
// );
// std::cout<<"Bounds1: "
// <<vBounds.data()[0]<<" "
// <<vBounds.data()[1]<<" "
// <<vBounds.data()[2]<<" "
// <<vBounds.data()[3]<<" "
// <<vBounds.data()[4]<<" "
// <<vBounds.data()[5]<<std::endl;
// std::cout<<"Bounds1: "
// <<vBounds.data()[0]<<" "
// <<vBounds.data()[1]<<" "
// <<vBounds.data()[2]<<" "
// <<vBounds.data()[3]<<" "
// <<vBounds.data()[4]<<" "
// <<vBounds.data()[5]<<std::endl;
m_DRTImage1MetaInfo->SetSizeWithBounds(
vBounds.data(),
NULL,//vBounds.data(),
m_DRTGeometryMetaInfo->GetDRT1Size(),
m_DRTGeometryMetaInfo->GetDRT1Spacing()
);
ImageType3D::PointType PanelOffsetIEC1;
PanelOffsetIEC1[0] = -m_DRTGeometryMetaInfo->GetPanel1Offset();
PanelOffsetIEC1[1] = 0.0;
PanelOffsetIEC1[2] = 0.0;
// This HAS TO be calculated from the nominal isocenter.
m_DRTImage1MetaInfo->SetOriginLPS(
CalcDRTImageOrigin(
@ -2235,8 +2261,17 @@ 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;
@ -2255,8 +2290,15 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
// 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->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;
@ -2307,10 +2349,10 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
// m_DRTGeometryMetaInfo->GetProjectionCenter2())
// );
vBounds.clear();
vBounds = m_CTMetaInfo->CalculateRegions(
NominalIsocenter_wZcorrectionLPS//m_DRTImage2MetaInfo->GetProjectionOriginLPS()
);
// vBounds.clear();
// vBounds = m_CTMetaInfo->CalculateRegions(
// NominalIsocenter_wZcorrectionLPS//m_DRTImage2MetaInfo->GetProjectionOriginLPS()
// );
// std::cout<<"Bounds2: "
// <<vBounds.data()[0]<<" "
@ -2321,11 +2363,19 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
// <<vBounds.data()[5]<<std::endl;
m_DRTImage2MetaInfo->SetSizeWithBounds(
vBounds.data(),
NULL,//vBounds.data(),
m_DRTGeometryMetaInfo->GetDRT2Size(),
m_DRTGeometryMetaInfo->GetDRT2Spacing()
);
ImageType3D::PointType PanelOffsetIEC2;
PanelOffsetIEC2[0] = -m_DRTGeometryMetaInfo->GetPanel2Offset();
PanelOffsetIEC2[1] = 0.0;
PanelOffsetIEC2[2] = 0.0;
m_DRTImage2MetaInfo->SetOriginLPS(
CalcDRTImageOrigin(
m_DRTImage2MetaInfo->GetOrigin(),
@ -2336,7 +2386,30 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
m_DRTGeometryMetaInfo->GetProjectionAngle2IEC()) ,
//m_DRTGeometryMetaInfo->GetProjectionAngle2IEC(),//m_DRTImage2MetaInfo->GetProjectionAngleLPS(),
Std_DRT2LPS
));
std::cout<<"m_DRTImage2MetaInfo->GetOriginLPS()"<< m_DRTImage2MetaInfo->GetOriginLPS() <<std::endl;
m_DRTImage2MetaInfo->SetOriginLPS(
CalcDRTImageOrigin(
m_DRTImage2MetaInfo->GetOrigin(),
m_DRTImage2MetaInfo->GetCOV(),
NominalIsocenter_wZcorrectionLPS,//m_DRTImage2MetaInfo->GetProjectionOriginLPS(),
this->CalcProjectionAngleLPS(
m_CTMetaInfo->GetPatientOrientation(),
m_DRTGeometryMetaInfo->GetProjectionAngle2IEC()) ,
//m_DRTGeometryMetaInfo->GetProjectionAngle2IEC(),//m_DRTImage2MetaInfo->GetProjectionAngleLPS(),
Std_DRT2LPS
) -
CalcDRTImageOffset(
PanelOffsetIEC2,
this->CalcProjectionAngleLPS(
m_CTMetaInfo->GetPatientOrientation(),
m_DRTGeometryMetaInfo->GetProjectionAngle2IEC() ),
Std_DRT2LPS
)
);
m_DRTImage2MetaInfo->SetImageDirectionsLPS(
@ -2354,8 +2427,15 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
// 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()"<< m_DRTImage2MetaInfo->GetOriginLPS() <<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;
@ -2389,6 +2469,23 @@ 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(){
@ -2997,13 +3094,13 @@ vtkImageData* itkImageProcessor::GetProjection2VTK()
// double* dBounds = toVTK2D2->GetOutput()->GetBounds();
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;
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

@ -106,6 +106,13 @@ public:
double GetSCD1();
double GetSCD2();
/** Panel offsets - panel offsets IEC */
void SetPanelOffsets(double,double);
/** Get projection angles - Gantry angle LPS
* Only meaningful after a 3D Volume is loaded */
double GetPanelOffset1();
double GetPanelOffset2();
/** Sets the degree of freedom for omptimzation*/
void SetDegreeOfFreedom(tDegreeOfFreedomEnum);
tDegreeOfFreedomEnum GetDegreeOfFreedom();
@ -338,6 +345,13 @@ private:
);
ImageType3D::PointType
CalcDRTImageOffset(
ImageType3D::PointType m_DRTOffset,
double dAngle,
InternalImageType::DirectionType stdDRT2LPS
);
TransformType::Pointer
MapTransformToNewOrigin(
ImageType3D::PointType m_COR,