Some work on UI
This commit is contained in:
@ -471,7 +471,7 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector<std::string> v_fnames){
|
||||
|
||||
imageSeriesReader3D->SetImageIO(dicomIO);
|
||||
imageSeriesReader3D->SetFileNames(v_sortedFnames);
|
||||
//imageSeriesReader3D->SetNumberOfWorkUnits(8);
|
||||
imageSeriesReader3D->SetNumberOfWorkUnits(8);
|
||||
imageSeriesReader3D->ForceOrthogonalDirectionOff(); // properly read CTs with gantry tilt
|
||||
//imageSeriesReader3D->SetSpacingWarningRelThreshold();
|
||||
|
||||
@ -1362,6 +1362,85 @@ void itkImageProcessor::CalculateExternalUserTransform(TransformType::Pointer tr
|
||||
m_TransformMetaInfo->SetUserRotations(LPStoIEC_Directions * rotationUser);
|
||||
}
|
||||
|
||||
itkImageProcessor::TransformType::Pointer
|
||||
itkImageProcessor::CalculateInternalTransformV2(
|
||||
ImageType3D::PointType m_ImportOffsetLPS,
|
||||
ImageType3D::PointType m_RotationOffsetIEC,
|
||||
ImageType3D::PointType m_TranslationUserIEC,
|
||||
ImageType3D::PointType m_RotationUserIEC,
|
||||
ImageType3D::PointType m_ProjectionCenterLPS,
|
||||
ImageType3D::PointType m_RTIsocenterLPS,
|
||||
InternalImageType::DirectionType m_IECtoLPSDirections
|
||||
){
|
||||
|
||||
const double dtr = (atan(1.0) * 4.0) / 180.0;
|
||||
|
||||
ImageType3D::PointType m_ROffsetLPS =
|
||||
m_IECtoLPSDirections * m_RotationOffsetIEC;
|
||||
|
||||
ImageType3D::PointType m_TUserLPS =
|
||||
m_IECtoLPSDirections * m_TranslationUserIEC;
|
||||
|
||||
ImageType3D::PointType m_RUserLPS =
|
||||
m_IECtoLPSDirections * m_RotationUserIEC;
|
||||
|
||||
|
||||
TransformType::OutputVectorType translation;
|
||||
translation[0] = m_TUserLPS[0];
|
||||
translation[1] = m_TUserLPS[1];
|
||||
translation[2] = m_TUserLPS[2];
|
||||
|
||||
ImageType3D::PointType m_TransformRotations;
|
||||
m_TransformRotations[0] = m_ROffsetLPS[0] + m_RUserLPS[0] ;
|
||||
m_TransformRotations[1] = m_ROffsetLPS[1] + m_RUserLPS[1] ;
|
||||
m_TransformRotations[2] = m_ROffsetLPS[2] + m_RUserLPS[2] ;
|
||||
|
||||
ImageType3D::PointType m_RTIsocenterLPSNEG;
|
||||
m_RTIsocenterLPSNEG[0] = -m_RTIsocenterLPS[0] + m_ProjectionCenterLPS[0];
|
||||
m_RTIsocenterLPSNEG[1] = -m_RTIsocenterLPS[1] + m_ProjectionCenterLPS[0];
|
||||
m_RTIsocenterLPSNEG[2] = -m_RTIsocenterLPS[2] + m_ProjectionCenterLPS[0];
|
||||
|
||||
// Map user to the projection center
|
||||
TransformType::Pointer m_IsoTransformZeroAtCTOrigin =
|
||||
MapTransformToNewOrigin (
|
||||
m_RTIsocenterLPSNEG,
|
||||
translation,
|
||||
m_TransformRotations
|
||||
);
|
||||
|
||||
TransformType::Pointer m_OutputTransform =
|
||||
TransformType::New();
|
||||
m_OutputTransform ->SetComputeZYX(true);
|
||||
m_OutputTransform ->SetIdentity();
|
||||
|
||||
TransformType::OutputVectorType translation_Out;
|
||||
translation_Out[0] =
|
||||
m_IsoTransformZeroAtCTOrigin->GetTranslation()[0] +
|
||||
m_ImportOffsetLPS[0] +
|
||||
m_ProjectionCenterLPS[0];
|
||||
translation_Out[1] =
|
||||
m_IsoTransformZeroAtCTOrigin->GetTranslation()[1] +
|
||||
m_ImportOffsetLPS[1] +
|
||||
m_ProjectionCenterLPS[1];
|
||||
translation_Out[2] =
|
||||
m_IsoTransformZeroAtCTOrigin->GetTranslation()[2] +
|
||||
m_ImportOffsetLPS[2] +
|
||||
m_ProjectionCenterLPS[2];
|
||||
|
||||
m_OutputTransform->SetTranslation(
|
||||
translation_Out);
|
||||
|
||||
m_OutputTransform->SetRotation(
|
||||
m_IsoTransformZeroAtCTOrigin->GetAngleX(),
|
||||
m_IsoTransformZeroAtCTOrigin->GetAngleY(),
|
||||
m_IsoTransformZeroAtCTOrigin->GetAngleZ());
|
||||
|
||||
m_OutputTransform->SetCenter(
|
||||
m_ProjectionCenterLPS);
|
||||
|
||||
return m_OutputTransform;
|
||||
|
||||
}
|
||||
|
||||
itkImageProcessor::TransformType::Pointer
|
||||
itkImageProcessor::CalculateInternalTransform(
|
||||
@ -1401,7 +1480,7 @@ itkImageProcessor::CalculateInternalTransform(
|
||||
// Map offset to the projection center
|
||||
TransformType::Pointer m_OffsetTransform =
|
||||
MapTransformToNewOrigin (
|
||||
m_ProjectionTransformCenter - m_UserTransformCenter,//m_OffsetTransformCenter,
|
||||
m_ProjectionTransformCenter - m_UserTransformCenter,
|
||||
m_TOffsetLPS,
|
||||
m_ROffsetLPS
|
||||
);
|
||||
@ -1429,7 +1508,7 @@ itkImageProcessor::CalculateInternalTransform(
|
||||
m_ProjectionTransformCenter);
|
||||
|
||||
|
||||
std::cout<<m_OutputTransform<<std::endl;
|
||||
//std::cout<<m_OutputTransform<<std::endl;
|
||||
|
||||
return
|
||||
m_OutputTransform;
|
||||
@ -1829,8 +1908,6 @@ void itkImageProcessor::InitializeProjector()
|
||||
m_CTMetaInfo->GetLPS2IECDirections().GetTranspose();
|
||||
|
||||
TransformType::Pointer CurrTransform;
|
||||
//CurrTransform->SetComputeZYX(true);
|
||||
//CurrTransform->SetIdentity();
|
||||
|
||||
if(m_RTMetaInfo == NULL)
|
||||
{
|
||||
@ -1839,11 +1916,6 @@ void itkImageProcessor::InitializeProjector()
|
||||
ImageType3D::PointType pFakeIsoLPS =
|
||||
m_DRTImage1MetaInfo->GetProjectionOriginLPS();
|
||||
|
||||
//ImageType3D::PointType pFakeIsoLPS =
|
||||
// m_CTMetaInfo->GetProjectionOriginLPS(
|
||||
// m_DRTGeometryMetaInfo->GetProjectionCenter1());
|
||||
|
||||
|
||||
CurrTransform =
|
||||
CalculateInternalTransform(
|
||||
ZeroPoint,
|
||||
@ -1855,7 +1927,7 @@ void itkImageProcessor::InitializeProjector()
|
||||
ZeroPoint,
|
||||
IECtoLPS_Directions
|
||||
);
|
||||
} else {
|
||||
} else {
|
||||
|
||||
CurrTransform =
|
||||
CalculateInternalTransform(
|
||||
@ -2238,20 +2310,6 @@ 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()
|
||||
// );
|
||||
|
||||
// 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(
|
||||
NULL,//vBounds.data(),
|
||||
m_DRTGeometryMetaInfo->GetDRT1Size(),
|
||||
@ -2270,21 +2328,12 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
|
||||
CalcDRTImageOrigin(
|
||||
m_DRTImage1MetaInfo->GetOrigin(),
|
||||
m_DRTImage1MetaInfo->GetCOV(),
|
||||
NominalIsocenter_wZcorrectionLPS,//m_DRTImage1MetaInfo->GetProjectionOriginLPS(),
|
||||
this->CalcProjectionAngleLPS(
|
||||
m_CTMetaInfo->GetPatientOrientation(),
|
||||
m_DRTGeometryMetaInfo->GetProjectionAngle1IEC() ),
|
||||
//m_DRTGeometryMetaInfo->GetProjectionAngle1IEC(),// m_DRTImage1MetaInfo->GetProjectionAngleLPS(),
|
||||
Std_DRT2LPS
|
||||
) /*-
|
||||
CalcDRTImageOffset(
|
||||
PanelOffsetIEC1,
|
||||
NominalIsocenter_wZcorrectionLPS,
|
||||
this->CalcProjectionAngleLPS(
|
||||
m_CTMetaInfo->GetPatientOrientation(),
|
||||
m_DRTGeometryMetaInfo->GetProjectionAngle1IEC() ),
|
||||
Std_DRT2LPS
|
||||
)*/
|
||||
|
||||
)
|
||||
);
|
||||
std::cout<<"CALIBRATION GetOriginLPS "<<m_DRTImage1MetaInfo->GetOriginLPS()<<std::endl;
|
||||
|
||||
@ -2354,28 +2403,9 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
|
||||
|
||||
m_DRTImage2MetaInfo->SetProjectionOriginLPS(
|
||||
CalibratedIsocenterLPS);
|
||||
// m_CTMetaInfo->GetProjectionOriginLPS(
|
||||
// m_DRTGeometryMetaInfo->GetProjectionCenter2())
|
||||
// );
|
||||
|
||||
m_DRTImage2MetaInfo->SetProjectionOriginLPSZero(
|
||||
CalibratedIsocenterZeroLPS);
|
||||
// m_CTMetaInfo->GetProjectionOriginLPSZero(
|
||||
// m_DRTGeometryMetaInfo->GetProjectionCenter2())
|
||||
// );
|
||||
|
||||
// vBounds.clear();
|
||||
// vBounds = m_CTMetaInfo->CalculateRegions(
|
||||
// NominalIsocenter_wZcorrectionLPS//m_DRTImage2MetaInfo->GetProjectionOriginLPS()
|
||||
// );
|
||||
|
||||
// std::cout<<"Bounds2: "
|
||||
// <<vBounds.data()[0]<<" "
|
||||
// <<vBounds.data()[1]<<" "
|
||||
// <<vBounds.data()[2]<<" "
|
||||
// <<vBounds.data()[3]<<" "
|
||||
// <<vBounds.data()[4]<<" "
|
||||
// <<vBounds.data()[5]<<std::endl;
|
||||
|
||||
m_DRTImage2MetaInfo->SetSizeWithBounds(
|
||||
NULL,//vBounds.data(),
|
||||
@ -2416,14 +2446,7 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){
|
||||
m_DRTGeometryMetaInfo->GetProjectionAngle2IEC()) ,
|
||||
//m_DRTGeometryMetaInfo->GetProjectionAngle2IEC(),//m_DRTImage2MetaInfo->GetProjectionAngleLPS(),
|
||||
Std_DRT2LPS
|
||||
) /*-
|
||||
CalcDRTImageOffset(
|
||||
PanelOffsetIEC2,
|
||||
this->CalcProjectionAngleLPS(
|
||||
m_CTMetaInfo->GetPatientOrientation(),
|
||||
m_DRTGeometryMetaInfo->GetProjectionAngle2IEC() ),
|
||||
Std_DRT2LPS
|
||||
)*/
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
@ -2650,7 +2673,15 @@ void itkImageProcessor::GetProjectionImages(){
|
||||
m_CTMetaInfo->GetImportOffset(),
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -237,7 +237,6 @@ private:
|
||||
using ResampleFilterType = itk::ResampleImageFilter<InternalImageType, InternalImageType>;
|
||||
|
||||
/** Optimizer which tries to find the minimn (Powell Optimizer)*/
|
||||
// using OptimizerType = itk::PowellOptimizer;
|
||||
using AmoebaOptimizerType = itk::AmoebaOptimizer;
|
||||
/** Optimizer which samples the whol space */
|
||||
using ExhaustiveOptimizerType = itk::ExhaustiveOptimizer;
|
||||
@ -266,7 +265,9 @@ private:
|
||||
using ITKtoVTKFilterType = itk::ImageToVTKImageFilter<OutputImageType>;
|
||||
|
||||
void
|
||||
CalculateExternalUserTransform(TransformType::Pointer transform, DRTImageMetaInformation::Pointer imageMetaInfo);
|
||||
CalculateExternalUserTransform(
|
||||
TransformType::Pointer transform,
|
||||
DRTImageMetaInformation::Pointer imageMetaInfo);
|
||||
|
||||
TransformType::Pointer
|
||||
CalculateInternalTransform(
|
||||
@ -280,6 +281,16 @@ private:
|
||||
InternalImageType::DirectionType m_IECtoLPSDirections
|
||||
);
|
||||
|
||||
TransformType::Pointer
|
||||
CalculateInternalTransformV2(
|
||||
ImageType3D::PointType m_ImportOffsetLPS,
|
||||
ImageType3D::PointType m_RotationOffsetIEC,
|
||||
ImageType3D::PointType m_TranslationUserIEC,
|
||||
ImageType3D::PointType m_RotationUserIEC,
|
||||
ImageType3D::PointType m_ProjectionCenterLPS,
|
||||
ImageType3D::PointType m_RTIsocenterLPS,
|
||||
InternalImageType::DirectionType m_IECtoLPSDirections
|
||||
);
|
||||
|
||||
TransformType::Pointer
|
||||
transform1,
|
||||
|
Reference in New Issue
Block a user