diff --git a/itkReg23DRT/DRTMetaInformation.cpp b/itkReg23DRT/DRTMetaInformation.cpp index 0d778d6..34f1dd5 100644 --- a/itkReg23DRT/DRTMetaInformation.cpp +++ b/itkReg23DRT/DRTMetaInformation.cpp @@ -11,6 +11,7 @@ static double FFS2IEC[9] = { 0, 0, -1, 0, -1, 0}; + namespace itk { @@ -31,7 +32,6 @@ TopogramImageMetaInformation(){ } - void TopogramImageMetaInformation ::PrintSelf(std::ostream& os, itk::Indent indent) const @@ -39,14 +39,12 @@ TopogramImageMetaInformation Superclass::PrintSelf(os, indent); } - TopogramImageMetaInformation ::~TopogramImageMetaInformation () { } - void TopogramImageMetaInformation :: SetPatientOrientation(tPatOrientation m_orient) { @@ -71,7 +69,6 @@ SetPatientOrientation(tPatOrientation m_orient) } - DRTImageMetaInformation:: DRTImageMetaInformation(){ @@ -112,7 +109,6 @@ DRTImageMetaInformation } - DRTImageMetaInformation::PointType DRTImageMetaInformation::GetOrigin() { @@ -132,67 +128,12 @@ DRTImageMetaInformation::GetOrigin() Origin; } - void DRTImageMetaInformation::SetSizeWithBounds( double* dBounds, SizeType MaxSize, SpacingType Spacing) { -// double dXmin = dBounds[0]; -// double dYmin = dBounds[1]; -// double dZmin = dBounds[2]; -// double dXmax = dBounds[3]; -// double dYmax = dBounds[4]; -// double dZmax = dBounds[5]; - -// double -// dNPixMin1 = 0., -// dNPixMin2 = 0., -// dNPixMax1 = 0., -// dNPixMax2 = 0.; - -// dNPixMin1 = abs(dXmin / Spacing[0]); -// dNPixMin2 = abs(dYmin / Spacing[0]); -// dNPixMax1 = abs(dXmax / Spacing[0]); -// dNPixMax2 = abs(dYmax / Spacing[0]); - -// double dPixMaxOverlap =dNPixMin1; - -// if(dPixMaxOverlap > dNPixMin2){ -// dPixMaxOverlap = dNPixMin2; -// } - -// if(dPixMaxOverlap > dNPixMax1){ -// dPixMaxOverlap = dNPixMax1; -// } - -// if(dPixMaxOverlap > dNPixMax2){ -// dPixMaxOverlap = dNPixMax2; -// } - -// if(floor(dPixMaxOverlap*2) > MaxSize[0]) { -// m_Size[0] = MaxSize[0]; -// } else { -// m_Size[0] = floor(dPixMaxOverlap*2); -// } - - - -// dNPixMin1 = abs(dZmin / Spacing[1]); -// dNPixMax1 = abs(dZmax / Spacing[1]); - -// dPixMaxOverlap =dNPixMin1; -// if(dPixMaxOverlap > dNPixMax1){ -// dPixMaxOverlap = dNPixMax1; -// } - -// if(floor(dPixMaxOverlap*2) > MaxSize[1]) { -// m_Size[1] = MaxSize[1]; -// } else { -// m_Size[1] = floor(dPixMaxOverlap*2); -// } - m_Size[0] = MaxSize[0]; m_Size[1] = MaxSize[1]; m_Size[2] = 1; @@ -202,7 +143,6 @@ void DRTImageMetaInformation::SetSizeWithBounds( return; } - DRTImageMetaInformation::PointType DRTImageMetaInformation::GetLPStoProjectionGeoLPSOffset() { @@ -263,10 +203,6 @@ CTVolumeImageMetaInformation::GetProjectionOriginLPS( PointType ProjectionCenter) { - // PointType Origin; - // Origin = this->m_OriginLPS; - // Origin = Origin - this->m_ImportOffset; - DirectionType IECtoLPS_Directions; IECtoLPS_Directions = this->m_LPS2IECDirections.GetTranspose(); @@ -360,7 +296,6 @@ CTVolumeImageMetaInformation(){ this->m_ImportOffset.Fill(0.); } - void CTVolumeImageMetaInformation ::PrintSelf(std::ostream& os, itk::Indent indent) const @@ -368,7 +303,6 @@ CTVolumeImageMetaInformation Superclass::PrintSelf(os, indent); } - CTVolumeImageMetaInformation ::~CTVolumeImageMetaInformation () { @@ -432,7 +366,6 @@ CTVolumeImageMetaInformation::GetOriginWOffset(){ this->m_OriginLPS - this->m_ImportOffset; } - DRTProjectionGeometryImageMetaInformation:: DRTProjectionGeometryImageMetaInformation(){ @@ -487,16 +420,12 @@ DRTProjectionGeometryImageMetaInformation Superclass::PrintSelf(os, indent); } - DRTProjectionGeometryImageMetaInformation ::~DRTProjectionGeometryImageMetaInformation () { } - - - RTGeometryMetaInformation:: RTGeometryMetaInformation(){ @@ -514,7 +443,6 @@ RTGeometryMetaInformation Superclass::PrintSelf(os, indent); } - RTGeometryMetaInformation ::~RTGeometryMetaInformation() { @@ -544,7 +472,6 @@ InternalTransformMetaInformation } - R23MetaInformation:: R23MetaInformation (){ @@ -553,7 +480,6 @@ R23MetaInformation (){ m_MetricType = tMetricTypeEnum::NCC; } - void R23MetaInformation ::PrintSelf(std::ostream& os, itk::Indent indent) const @@ -561,7 +487,6 @@ R23MetaInformation Superclass::PrintSelf(os, indent); } - R23MetaInformation ::~R23MetaInformation () { @@ -632,11 +557,4 @@ TransformMetaInformation } - - - - - - - } diff --git a/itkReg23DRT/DRTMetaInformation.h b/itkReg23DRT/DRTMetaInformation.h index 0297c66..a52b1d8 100644 --- a/itkReg23DRT/DRTMetaInformation.h +++ b/itkReg23DRT/DRTMetaInformation.h @@ -24,7 +24,6 @@ typedef enum eImageOrientationType{ FFS = 2 } tPatOrientation; - typedef enum eHandlingRotImpTransform { ALWAYS_USE = 0, NEVER_USE =1, @@ -42,7 +41,6 @@ typedef enum eDegreeOfFreedomType { OTHER =7 } tDegreeOfFreedomEnum; - typedef enum eOptimizerType{ POWELL = 0, AMOEBA = 1, @@ -54,7 +52,6 @@ typedef enum eMetricType{ MI = 1 } tMetricTypeEnum; - inline int GetNumberOfDOF(eDegreeOfFreedomType dof) { switch (dof) { @@ -76,7 +73,6 @@ inline int GetNumberOfDOF(eDegreeOfFreedomType dof) return 0; }; - class DegreeOfFreedom : public itk::Object { public: @@ -134,7 +130,6 @@ public: protected: - tPatOrientation m_PatientOrientation; @@ -149,7 +144,6 @@ protected: DirectionType m_LPS2IECDirections; - /** Default Constructor **/ TopogramImageMetaInformation (); /** Default Destructor **/ @@ -193,9 +187,6 @@ public: itkSetMacro(Spacing,SpacingType); itkGetMacro(Spacing,SpacingType); - //itkSetMacro(Origin,PointType); - //itkGetMacro(Origin,PointType); - itkSetMacro(OriginLPS,PointType); itkGetMacro(OriginLPS,PointType); @@ -645,9 +636,6 @@ public: itkSetEnumMacro(MetricType, tMetricTypeEnum); itkGetEnumMacro(MetricType, tMetricTypeEnum); - - - protected: tDegreeOfFreedomEnum @@ -693,7 +681,6 @@ public: /** object information streaming **/ void PrintSelf(std::ostream& os, itk::Indent indent) const; - itkSetMacro(HiddenTranslations,PointType); itkGetMacro(HiddenTranslations,PointType); diff --git a/itkReg23DRT/itkImageProcessor.cpp b/itkReg23DRT/itkImageProcessor.cpp index b4b795f..638d7fa 100644 --- a/itkReg23DRT/itkImageProcessor.cpp +++ b/itkReg23DRT/itkImageProcessor.cpp @@ -119,7 +119,7 @@ itkImageProcessor::itkImageProcessor() Point3D[1]=0.; Point3D[2]=175.; m_DRTGeometryMetaInfo->SetProjectionCenter(Point3D); - // m_DRTGeometryMetaInfo->SetProjectionCenter(Point3D); + ImageType3D::SizeType ImageSize; ImageSize[0]=512; @@ -164,7 +164,6 @@ void itkImageProcessor::SetNumberOfWorkingUnits(int iN){ } } - const CTVolumeImageMetaInformation::Pointer itkImageProcessor::GetCTMetaInfo( ){ @@ -188,7 +187,6 @@ itkImageProcessor::GetDRTGeoMetaInfo(){ } - void itkImageProcessor::PrintSelf(std::ostream& os, Indent indent) const { Superclass::PrintSelf(os, indent); @@ -221,7 +219,6 @@ double itkImageProcessor::GetSCD2(){ m_DRTImage2MetaInfo ->GetSCD(); } - double itkImageProcessor::GetPanelOffsetPGeo(tProjOrientationType ImgPrj){ if(m_CTMetaInfo == NULL || @@ -269,8 +266,6 @@ double itkImageProcessor::GetPanelOffset2(){ m_DRTGeometryMetaInfo ->GetPanel2Offset(); } - - tDegreeOfFreedomEnum itkImageProcessor::GetDegreeOfFreedom() { @@ -288,7 +283,6 @@ void itkImageProcessor::SetUseRotationsForImportOffset(bool bVal){ return; } - void itkImageProcessor::SetCustom_ImportTransform(double dTx, double dTy, double dTz, @@ -343,7 +337,6 @@ void itkImageProcessor::SetCustom_ProjectionCenterOffsetFixedAxes_IEC( } - void itkImageProcessor::SetCustom_ProjectionCenterFixedAxes_IEC( double dX1, double dY1, @@ -378,7 +371,7 @@ void itkImageProcessor::SetCustom_2Dres(double nX1,double nY1,double nX2,double Spacing [1] = nY2; Spacing [2] = 1.; m_DRTGeometryMetaInfo->SetDRT2Spacing(Spacing); - //TODO UPDATE TO FOLLOW + } void itkImageProcessor::SetCustom_2Dsize(int nX1, int nY1,int nX2,int nY2) @@ -399,7 +392,6 @@ void itkImageProcessor::SetCustom_2Dsize(int nX1, int nY1,int nX2,int nY2) Size [2] = 1.; m_DRTGeometryMetaInfo->SetDRT2Size(Size); - //TODO UPDATE TO FOLLOW } void itkImageProcessor::SetCustom_UpdateMetaInfo(){ @@ -424,7 +416,6 @@ int itkImageProcessor::unload3DVolumeAndMeta(){ m_TransformMetaInfo = NULL; m_TransformMetaInfo = TransformMetaInformation::New(); - this->ResetROIRegions(); return 1; @@ -436,8 +427,8 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector v_fnames){ tPatOrientation m_PatOrientation = tPatOrientation::NotDefined; - /* Since are not sure DB indexer to sort images, - * we run the IPP sorter here. */ + /* Since are not sure what we get here, + * we run the IPP sorter. */ using IppSorterType = gdcm::IPPSorter; IppSorterType ZSorter; @@ -450,12 +441,6 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector v_fnames){ return EXIT_FAILURE; } - /* Some debugging output */ - //std::cout << "Sorting succeeded:" << std::endl; - //ZSorter.Print( std::cout ); - //std::cout << "Found z-spacing:" << std::endl; - //std::cout << ZSorter.GetZSpacing() << std::endl; - const std::vector & v_sortedFnames = ZSorter.GetFilenames(); @@ -472,7 +457,6 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector v_fnames){ imageSeriesReader3D->SetFileNames(v_sortedFnames); imageSeriesReader3D->SetNumberOfWorkUnits(iNWUnits); imageSeriesReader3D->ForceOrthogonalDirectionOff(); // properly read CTs with gantry tilt - //imageSeriesReader3D->SetSpacingWarningRelThreshold(); imageSeriesReader3D->Update(); @@ -505,8 +489,6 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector v_fnames){ return -1; } - ////////////////////////*****************////////////////////////// - CastFilterType3D::Pointer caster3D = CastFilterType3D::New(); @@ -532,22 +514,13 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector v_fnames){ const typename ImageType3D::SizeType& inputSize = inputRegion.GetSize(); - // Inputs Info - // std::cout << "inputSpacing " << std::endl; - // std::cout << inputSpacing << std::endl; - // std::cout << "inputRegion " << std::endl; - // std::cout << inputRegion << std::endl; - // std::cout << "inputSize " << std::endl; - // std::cout << inputSize << std::endl; - - ImageType3D::SpacingType outputSpacing; outputSpacing[0] = inputSpacing[0]; outputSpacing[1] = inputSpacing[1]; outputSpacing[2] = m_SamplingLNG; ImageType3D::SizeType outputSize; - // typedef typename ImageType3D::SizeType::SizeValueType SizeValueType; + outputSize[0] = static_cast( inputSize[0] * inputSpacing[0] / outputSpacing[0] + .5); outputSize[1] = static_cast( @@ -576,17 +549,9 @@ int itkImageProcessor::load3DSerieFromFiles( std::vector v_fnames){ } - ////////////////////////*****************////////////////////////// - if (m_VolumeSourceDupli == NULL) std::cout << "NEVER HERE m_VolumeSourceDupli" << std::endl; - // if (m_VolumeSourceDupli) { - // std::cout << "NEVER HERE m_VolumeSourceDupli" << std::endl; - // m_VolumeSourceDupli = NULL; - // m_VolumeSourceDupli = DuplicatorType::New(); - // } - m_VolumeSourceDupli->SetInputImage(caster3D->GetOutput()); m_VolumeSourceDupli->Update(); @@ -633,7 +598,6 @@ int itkImageProcessor::fill3DVolumeMeta( m_RTMetaInfo = NULL; } - /* copy useful meta information into the CT container */ m_CTMetaInfo = CTVolumeImageMetaInformation::New(); m_CTMetaInfo->SetPatientOrientation(m_PatOrientation); @@ -648,8 +612,6 @@ int itkImageProcessor::fill3DVolumeMeta( PointOffset.Fill(0.); m_CTMetaInfo->SetImportOffset(PointOffset); - - /* initialise DRT meta */ m_DRTImage1MetaInfo = DRTImageMetaInformation::New(); m_DRTImage1MetaInfo->SetProjectionAngleLPS( @@ -664,7 +626,6 @@ int itkImageProcessor::fill3DVolumeMeta( m_DRTGeometryMetaInfo->GetSCD1Offset() ); - /* Calculate projection angle IEC to LPS */ m_DRTImage2MetaInfo = DRTImageMetaInformation::New(); m_DRTImage2MetaInfo->SetProjectionAngleLPS( @@ -679,35 +640,12 @@ int itkImageProcessor::fill3DVolumeMeta( m_DRTGeometryMetaInfo->GetSCD2Offset() ); - // std::cout<< "///////////////// 3D VOLUME BEG ///////////////" <GetOriginLPS() <GetCOV() <GetImportOffset() <GetLPS2IECDirections() <GetSize() <GetSpacing() <GetProjectionAngleLPS() <GetSCD() <GetProjectionAngleLPS() <GetSCD() <UpdateProjectionGeometryMeta(); - // To simply Siddon-Jacob's fast ray-tracing algorithm, we force the origin of the CT image - // to be (0,0,0). Because we align the CT isocenter with the central axis, the projection - // geometry is fully defined. The origin of the CT image becomes irrelavent. - - // this is done internally in the dSiddonFilter. - - return EXIT_SUCCESS; - } const std::vector itkImageProcessor::GetRTImportOffset() @@ -777,15 +715,12 @@ itkImageProcessor::CalcProjectionAngleLPS( tPatOrientation pOrient, double pAngleIEC){ - // std::cout<< "CalcProjectèionAngleLPS :: pAngleIEC " << pAngleIEC <SetProjectionAngle2OffsetIEC(dOff2); } - void itkImageProcessor::SetProjectionAngle1IEC(double dGantryAngle) { m_DRTGeometryMetaInfo->SetProjectionAngle1IEC(dGantryAngle); @@ -952,8 +886,6 @@ int itkImageProcessor::load2D(const char * pcFName){ } tokens.clear(); - // std::cout<<"Intensity window center and width: "<< dIntensityWindow[0] <<" "<< dIntensityWindow[1] <GetOutput()->GetDirection(); -// std::cout<<"LocalizerImagDirectionDCM " <GetOutput(); - //double* m_ImageIntensity; DuplicatorType::Pointer m_Duplicator; TopogramImageMetaInformation::Pointer m_TImageMeta; @@ -1077,10 +993,8 @@ int itkImageProcessor::load2D(const char * pcFName){ m_PASourceDupli = DuplicatorType::New(); } - //m_ImageIntensity = d_image1IntensityWindow; m_Duplicator = m_PASourceDupli; m_TImageMeta = m_TImage1MetaInfo; - // m_ImLoaded = &image2D1Loaded; break; @@ -1091,9 +1005,7 @@ int itkImageProcessor::load2D(const char * pcFName){ m_LATSourceDupli = DuplicatorType::New(); } - //m_ImageIntensity = d_image2IntensityWindow; m_Duplicator = m_LATSourceDupli; - // m_ImLoaded = &image2D2Loaded; m_TImageMeta = m_TImage2MetaInfo; break; @@ -1119,28 +1031,11 @@ int itkImageProcessor::load2D(const char * pcFName){ m_Duplicator->SetInputImage(caster2DInput->GetOutput() ); m_Duplicator->Update(); -// InternalImageType::IndexType pIndex; -// pIndex[0]=200; -// pIndex[1]=300; -// InternalImageType::PixelType pPixel = -// m_Duplicator->GetOutput()->GetPixel(pIndex); - //std::cout<<"processro PIXEL: "<GetOutput()->GetDirection()<GetOutput()->GetOrigin()<GetOutput()->GetSpacing()<GetOutput()->GetLargestPossibleRegion().GetSize()<SetSubtractMean(bSm); } - void itkImageProcessor::InitializeProjector() { @@ -1504,7 +1393,6 @@ void itkImageProcessor::InitializeProjector() filter2 = ChangeInformationFilterType::New(); - /* First of all we need the center of the Projection images in its reference frame */ resampleFilter1->Update(); filter1->SetInput( resampleFilter1->GetOutput() ); @@ -1514,8 +1402,6 @@ void itkImageProcessor::InitializeProjector() filter1->ChangeOriginOn(); filter1->UpdateOutputInformation(); - // std::cout<< "itkImageProcessor::InitializeProjector() " <Update(); filter2->SetInput( resampleFilter2 ->GetOutput() ); @@ -1533,8 +1419,6 @@ void itkImageProcessor::InitializeProjector() } - - itkImageProcessor::InternalImageType::DirectionType itkImageProcessor::CalcDRTImageDirections( double angle, @@ -1571,7 +1455,6 @@ int itkImageProcessor::unloadRTPlanAndMeta(){ return 0; } - void itkImageProcessor::loadRTPlanInfo( double dIsoX, double dIsoY, double dIsoZ, double dLAT, double dVRT ,double dLNG){ @@ -1607,7 +1490,6 @@ void itkImageProcessor::loadRTPlanInfo( m_RTMetaInfo->SetIsocenterIECS(Point); - ImageType3D::PointType pZero (3); pZero.Fill(0.); @@ -1656,7 +1538,6 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){ //TODO. } - // FIRST ImageType3D::PointType NominalIsocenter_wZcorrectionLPS; @@ -1679,12 +1560,6 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){ IsocenterOffsetLPS = m_CTMetaInfo->ConvertIECPointToLPSPoint( m_DRTGeometryMetaInfo->GetProjectionCenterOffset1()); - // std::cout<< "///////////////// PGEOM META BEG ///////////////" <GetProjectionCenter() <GetSpacing()[1]/2*/; CalibratedIsocenterZeroLPS[2] = NominalIsocenterZero_wZcorrectionLPS[2] + IsocenterOffsetLPS[2] /*+ m_CTMetaInfo->GetSpacing()[2]/2*/; -// std::cout<<"CALIBRATION CalibratedIsocenterZeroLPS "<SetProjectionAngleLPS( this->CalcProjectionAngleLPS( @@ -1877,13 +1750,10 @@ void itkImageProcessor::UpdateProjectionGeometryMeta(){ } - /* Nobody should go through all this... To be very careful editing ... - */ - itkImageProcessor::ImageType3D::PointType itkImageProcessor::CalcDRTImageOrigin( ImageType3D::PointType m_DRTOrigin, @@ -1903,11 +1773,8 @@ itkImageProcessor::CalcDRTImageOrigin( NewOrigin; } - - void itkImageProcessor::GetProjectionImages(){ - // std::cout<< "itkImageProcessor::GetProjectionImages" <SetComputeZYX(true); transform1->SetIdentity(); @@ -1948,18 +1812,6 @@ void itkImageProcessor::GetProjectionImages(){ transform1 ->SetCenter( m_DRTImage1MetaInfo->GetProjectionOriginLPSZero()); -// std::cout<< "CurrTransform Rotations: "<< -// CurrTransform->GetAngleX() <<" "<< -// CurrTransform->GetAngleY() <<" "<< -// CurrTransform->GetAngleZ() <<" "<< std::endl; - -// std::cout<< "CurrTransform Translations: "<< -// CurrTransform->GetTranslation()<GetCenter()<Print(std::cout); // The parameters of interpolator1, such as ProjectionAngle and FocalPointToIsocenterDistance // have been set before registration. Here we only need to replace the initial // transform with the final transform. @@ -2043,8 +1895,6 @@ itkImageProcessor::CalcImportVolumeOffset( ImageType3D::PointType IsoSupport_IECPos = InputTransform->TransformPoint(rtCouchOffset ); - - InternalImageType::DirectionType VolumeIECtoLPS; VolumeIECtoLPS = VolumeLPStoIEC.GetTranspose(); @@ -2065,7 +1915,6 @@ itkImageProcessor::CalcImportVolumeOffset( } - void itkImageProcessor::Write2DImages(){ // using RescaleFilterType = itk::RescaleIntensityImageFilter; @@ -2139,46 +1988,6 @@ vtkImageData* itkImageProcessor::GetLocalizer1VTK() toVTKLocalizer1->SetInput(rescaler1->GetOutput()); toVTKLocalizer1->Update(); -// if(false) { -//// using ImageRegionType3D = ImageType3D::RegionType; -//// using SizeType3D = ImageRegionType3D::SizeType; -//// using ImageDirectionType3D = ImageType3D::DirectionType; - -//// ImageRegionType3D region3D = rescaler1->GetOutput()->GetBufferedRegion(); -//// SizeType3D size3D = region3D.GetSize(); -//// //ImageType3D::PointType origin3D = rescaler1->GetOutput()->GetOrigin(); -//// const itk::Vector resolution3D = rescaler1->GetOutput()->GetSpacing(); -//// ImageDirectionType3D imagDirection = rescaler1->GetOutput()->GetDirection(); - -//// /* calculate image size in 3D Space */ -//// using VectorType = itk::Vector; -//// VectorType Dest; -//// Dest[0]=(size3D[0]-1) * resolution3D[0]; -//// Dest[1]=(size3D[1]-1) * resolution3D[1]; -//// Dest[2]=(size3D[2]-1) * resolution3D[2]; - - -// // ImageType3D::PointType LastVoxelPosition = -// // origin3D + (imagDirection * Dest); - -// // std::cout<<" -------- Localizer 1 ITK --------"<GetOutput()->GetBounds(); - -// // std::cout<< "-------- Localizer 1 VTK --------" <GetOutput(); } @@ -2197,46 +2006,6 @@ vtkImageData* itkImageProcessor::GetLocalizer2VTK() toVTKLocalizer2->SetInput(rescaler2->GetOutput()); toVTKLocalizer2->Update(); - -// if(true) { -// using ImageRegionType3D = ImageType3D::RegionType; -// using SizeType3D = ImageRegionType3D::SizeType; -// using ImageDirectionType3D = ImageType3D::DirectionType; - -// ImageRegionType3D region3D = rescaler2->GetOutput()->GetBufferedRegion(); -// SizeType3D size3D = region3D.GetSize(); -// ImageType3D::PointType origin3D = rescaler2->GetOutput()->GetOrigin(); -// const itk::Vector resolution3D = rescaler2->GetOutput()->GetSpacing(); -// ImageDirectionType3D imagDirection = rescaler2->GetOutput()->GetDirection(); - -// /* calculate image size in 3D Space */ -// using VectorType = itk::Vector; -// VectorType Dest; -// Dest[0]=(size3D[0]-1) * resolution3D[0]; -// Dest[1]=(size3D[1]-1) * resolution3D[1]; -// Dest[2]=(size3D[2]-1) * resolution3D[2]; - -// ImageType3D::PointType LastVoxelPosition = -// origin3D + (imagDirection * Dest); - -// // std::cout<<" -------- Localizer 2 ITK --------"<GetOutput()->GetBounds(); -// // std::cout<< "-------- Localizer 2 VTK --------" <GetOutput(); } @@ -2300,49 +2069,6 @@ vtkImageData* itkImageProcessor::GetProjection1VTKToWrite() toVTK2D1->SetInput(intWindowFilter->GetOutput()); toVTK2D1->Update(); -// using ImageCalculatorFilterType2 = itk::MinimumMaximumImageCalculator; -// auto imageCalculatorFilter2 = ImageCalculatorFilterType2::New(); -// imageCalculatorFilter2->SetImage(intWindowFilter->GetOutput()); -// imageCalculatorFilter2->Compute(); -// std::cout<< "itkImageProcessor::imageCalculatorFilter2() " << -// imageCalculatorFilter2->GetMinimum() << " " << imageCalculatorFilter2->GetMaximum() <GetOutput()->GetBufferedRegion(); - // SizeType3D size3D = region3D.GetSize(); - // ImageType3D::PointType origin3D = rescaler1->GetOutput()->GetOrigin(); - // const itk::Vector resolution3D = rescaler1->GetOutput()->GetSpacing(); - // ImageDirectionType3D imagDirection = rescaler1->GetOutput()->GetDirection(); - - // /* calculate image size in 3D Space */ - // using VectorType = itk::Vector; - // VectorType Dest; - // Dest[0]=(size3D[0]-1) * resolution3D[0]; - // Dest[1]=(size3D[1]-1) * resolution3D[1]; - // Dest[2]=(size3D[2]-1) * resolution3D[2]; - - // ImageType3D::PointType LastVoxelPosition = - // origin3D + (imagDirection * Dest); - - // std::cout<<" -------- Projection 1 ITK --------"<GetOutput()->GetBounds(); - - // std::cout<< "-------- Proj 1 --------" <GetOutput(); } @@ -2393,8 +2119,6 @@ vtkMatrix4x4 * itkImageProcessor::GetProjection2VTKTransform() m_Projection2VTKTransform->SetElement(2,3, interpolator2->GetInverseTransform()->GetTranslation()[2]); - - return m_Projection2VTKTransform; @@ -2426,8 +2150,6 @@ vtkImageData* itkImageProcessor::GetProjection2VTK() toVTK2D2->GetOutput(); } - - vtkImageData* itkImageProcessor::GetProjection2VTKToWrite() { if(m_DRTImage2MetaInfo == NULL || @@ -2457,54 +2179,9 @@ vtkImageData* itkImageProcessor::GetProjection2VTKToWrite() intWindowFilter->SetInput(imageDRT2In); intWindowFilter->Update(); - toVTK2D2->SetInput(intWindowFilter->GetOutput()); toVTK2D2->Update(); -// using ImageCalculatorFilterType2 = itk::MinimumMaximumImageCalculator; -// auto imageCalculatorFilter2 = ImageCalculatorFilterType2::New(); -// imageCalculatorFilter2->SetImage(intWindowFilter->GetOutput()); -// imageCalculatorFilter2->Compute(); -// std::cout<< "itkImageProcessor::imageCalculatorFilter2() " << -// imageCalculatorFilter2->GetMinimum() << " " << imageCalculatorFilter2->GetMaximum() <GetOutput()->GetBufferedRegion(); - // SizeType3D size3D = region3D.GetSize(); - // ImageType3D::PointType origin3D = rescaler2->GetOutput()->GetOrigin(); - // const itk::Vector resolution3D = rescaler2->GetOutput()->GetSpacing(); - // ImageDirectionType3D imagDirection = rescaler2->GetOutput()->GetDirection(); - - /* calculate image size in 3D Space */ - // using VectorType = itk::Vector; - // VectorType Dest; - // Dest[0]=(size3D[0]-1) * resolution3D[0]; - // Dest[1]=(size3D[1]-1) * resolution3D[1]; - // Dest[2]=(size3D[2]-1) * resolution3D[2]; - - // ImageType3D::PointType LastVoxelPosition = - // origin3D + (imagDirection * Dest); - - // std::cout<<" -------- Projection 2 ITK --------"<GetOutput()->GetBounds(); - // std::cout<< "-------- Proj 2 --------" <GetOutput(); } @@ -2519,14 +2196,11 @@ void itkImageProcessor::WriteProjectionImages() rescaler1->SetOutputMinimum(0); rescaler1->SetOutputMaximum(255); rescaler1->SetInput( imageDRT1In ); - // flipFilter1->GetOutput()); RescaleFilterType::Pointer rescaler2 = RescaleFilterType::New(); rescaler2->SetOutputMinimum(0); rescaler2->SetOutputMaximum(255); rescaler2->SetInput( imageDRT2In ); - // flipFilter2->GetOutput()); - using WriterType = itk::ImageFileWriter; WriterType::Pointer writer1 = WriterType::New(); @@ -2537,7 +2211,6 @@ void itkImageProcessor::WriteProjectionImages() try { - // std::cout << "Writing image 1 " << std::endl; writer1->Update(); } catch (itk::ExceptionObject & err) @@ -2551,7 +2224,6 @@ void itkImageProcessor::WriteProjectionImages() try { - // std::cout << "Writing image 2" << std::endl; writer2->Update(); } catch (itk::ExceptionObject & err) @@ -2562,10 +2234,6 @@ void itkImageProcessor::WriteProjectionImages() } - - - - void itkImageProcessor::SetInitialTranslations(double dX, double dY, double dZ) { @@ -2590,7 +2258,6 @@ void itkImageProcessor::SetInitialRotations(double dX, double dY, double dZ) m_TransformMetaInfo->SetUserRotations(Rotations); - } Optimizer::ParametersType @@ -2678,9 +2345,6 @@ void itkImageProcessor::SetRegionFixed1( roiAutoReg1.SetIndex(index1); roiAutoReg1.SetSize(size1); - //std::cout << "itkImageProcessor " << std::endl; - //std::cout << roiAutoReg1 << std::endl; - this->m_R23->SetroiAutoReg1(roiAutoReg1); } @@ -2703,21 +2367,12 @@ void itkImageProcessor::SetRegionFixed2( roiAutoReg2.SetIndex(index2); roiAutoReg2.SetSize(size2); - //std::cout << "itkImageProcessor " << std::endl; - //std::cout << roiAutoReg2 << std::endl; - this->m_R23->SetroiAutoReg2(roiAutoReg2); } void itkImageProcessor::ResetROIRegions(){ -// auto region1temp = m_PASourceDupli->GetOutput()->GetBufferedRegion(); -// auto region2temp = m_LATSourceDupli->GetOutput()->GetBufferedRegion(); - -// this->m_R23->SetroiAutoReg1(region1temp); -// this->m_R23->SetroiAutoReg2(region2temp); - this->m_R23->setROISizeToZero(); } diff --git a/itkReg23DRT/itkImageProcessor.h b/itkReg23DRT/itkImageProcessor.h index dbd5cdd..ffb8127 100644 --- a/itkReg23DRT/itkImageProcessor.h +++ b/itkReg23DRT/itkImageProcessor.h @@ -342,7 +342,6 @@ private: imageDRT2In; - DuplicatorType::Pointer m_LATSourceDupli, m_PASourceDupli, diff --git a/itkReg23DRT/itkImageProcessorHelpers.cpp b/itkReg23DRT/itkImageProcessorHelpers.cpp index 8d0760b..2d76b88 100644 --- a/itkReg23DRT/itkImageProcessorHelpers.cpp +++ b/itkReg23DRT/itkImageProcessorHelpers.cpp @@ -63,8 +63,6 @@ MapTransformToNewOrigin( return m_OutputTransform; } - - TransformType::Pointer CalculateInternalTransformV3( ImageType3D::PointType m_Translation, //IEC diff --git a/itkReg23DRT/itkQtIterationUpdate.h b/itkReg23DRT/itkQtIterationUpdate.h index d6ed115..d0705e5 100644 --- a/itkReg23DRT/itkQtIterationUpdate.h +++ b/itkReg23DRT/itkQtIterationUpdate.h @@ -54,9 +54,6 @@ private: bAbortProcessCommand; - - - signals: void sendRegistrationProgress(int,double,double,double,double); @@ -67,7 +64,6 @@ namespace itk class CommandIterationUpdate : public itk::Command { - // TODO: Move to own files. constexpr static unsigned int Dimension = 3; @@ -127,7 +123,6 @@ public: objIterUpdate->setAbortFlag(false); throw itk::ProcessAborted(); } -// std::cout << "Progress: " << this->m_Process->GetAbortGenerateData() << std::endl; OptimizerPointer optPow; AmoebaOptimizerPointer optAm; @@ -168,7 +163,6 @@ public: }; class ExhaustiveCommandIterationUpdate : public itk::Command { - // TODO: Move to own files. public: using Self = ExhaustiveCommandIterationUpdate; diff --git a/itkReg23DRT/itkReg23.cpp b/itkReg23DRT/itkReg23.cpp index 10acd49..8169b5f 100644 --- a/itkReg23DRT/itkReg23.cpp +++ b/itkReg23DRT/itkReg23.cpp @@ -30,8 +30,6 @@ itkReg23::itkReg23() registration->SetTransform1(Transform1); registration->SetTransform2(Transform2); - - // to be provided by the user m_r23Meta = nullptr; m_Volume = nullptr; @@ -44,14 +42,11 @@ itkReg23::itkReg23() m_TransformMetaInfo = nullptr; m_OptimizerObserver = nullptr; - // m_UseFullROI = true; // if the full image ROI shall be used m_UseDumptoFile = false; //If each (!) optimzer result shall be dumpped into a file. - this->setROISizeToZero(); } - itkReg23::~itkReg23() { @@ -124,21 +119,6 @@ void itkReg23::InitializeRegistration() itkExceptionMacro(<< "m_interpolator2 data not present"); } -// std::cout << "Print r23" << -// m_r23Meta->GetMetricType() << " " << m_r23Meta->GetDegreeOfFreedom() << std::endl; -// std::cout << "Print Powell" << -// m_PowellMeta->GetStepLength() << " " << m_PowellMeta->GetStepTolerance() << std::endl; -// std::cout << "Print Amoeba" << -// m_AmoebaMeta->GetFunctionConvergenceTolerance() << " " << m_AmoebaMeta->GetSimplexDelta() << std::endl; -// std::cout << "Print NCC" << -// m_NCCMeta->GetSubtractMean() << " " << m_NCCMeta->GetMaxTranslation() << std::endl; -// std::cout << "Print MI" << -// m_MIMeta->GetMaxTranslation() << std::endl; - -// ExhaustiveOptimizerType::StepsType steps(3); -// const int numberOfSteps = 25; //In each direction. Total number of steps is ((2*numberOfSteps+1))^3. For 25 -> 132651. - //const double stepLength = 0.1; - switch (m_r23Meta->GetOptimizerType()) { case tOptimizerTypeEnum::POWELL: @@ -197,14 +177,6 @@ void itkReg23::InitializeRegistration() case tOptimizerTypeEnum::EXHAUSTIVE: std::cout<< "Using Extensive Optimizer" <SetNumberOfSteps(steps); -// ExhaustiveOptimizer->SetStepLength(stepLength); - -// registration->SetOptimizer(ExhaustiveOptimizer); - break; default: @@ -288,17 +260,9 @@ void itkReg23::InitializeRegistration() registration->SetIsocIECTransform(IsocTransform); - // if (verbose) { - // registration->DebugOn(); - // registration->Print(std::cout); - // } - - std::cout << "#" << __COMPACT_PRETTY_FUNCTION__ << std::endl; } - - int itkReg23::StartRegistration(std::string extraInfo) { @@ -306,8 +270,6 @@ int itkReg23::StartRegistration(std::string extraInfo) // TODO: Check if the registartion pipeline has been initialized using ParametersType = RegistrationType::ParametersType; - //auto startParameters = transform1->GetParameters(); - time_t t = time(0); // get time now struct tm* now = localtime(&t); @@ -323,9 +285,6 @@ int itkReg23::StartRegistration(std::string extraInfo) fs << extraInfo; fs << "Value\tX\tY\tZ " << std::endl; - // if (r23Meta->GetOptimizerType() == tOptimizerTypeEnum::EXHAUSTIVE) { - // ExhaustiveOptimizerObserver->set_stream(fs); - // } } // Start the registration @@ -358,7 +317,6 @@ int itkReg23::StartRegistration(std::string extraInfo) this->GetCurrentPosition(); std::cout<<" FinalPars: "<< finalParameters <GetOptimizerType()) { @@ -434,6 +390,4 @@ double itkReg23::GetCurrentMetricValue() } - - } diff --git a/itkReg23DRT/itkReg23.h b/itkReg23DRT/itkReg23.h index 1a6f62e..052a7dd 100644 --- a/itkReg23DRT/itkReg23.h +++ b/itkReg23DRT/itkReg23.h @@ -161,6 +161,7 @@ private: ExhaustiveOptimizer; /* ---- User provided */ + R23MetaInformation::Pointer m_r23Meta; @@ -201,7 +202,6 @@ private: /* ---- User provided END */ - TransformType::Pointer IsocTransform, Transform1, diff --git a/itkReg23DRT/itkReg23MetaInformation.cpp b/itkReg23DRT/itkReg23MetaInformation.cpp index 32d94a7..f895d8f 100644 --- a/itkReg23DRT/itkReg23MetaInformation.cpp +++ b/itkReg23DRT/itkReg23MetaInformation.cpp @@ -21,14 +21,12 @@ PowellOptimizerMetaInformation Superclass::PrintSelf(os, indent); } - PowellOptimizerMetaInformation ::~PowellOptimizerMetaInformation () { } - AmoebaOptimizerMetaInformation:: AmoebaOptimizerMetaInformation(){ @@ -39,7 +37,6 @@ AmoebaOptimizerMetaInformation(){ this->m_MaxIterations = 100; } - void AmoebaOptimizerMetaInformation ::PrintSelf(std::ostream& os, itk::Indent indent) const @@ -47,14 +44,12 @@ AmoebaOptimizerMetaInformation Superclass::PrintSelf(os, indent); } - AmoebaOptimizerMetaInformation ::~AmoebaOptimizerMetaInformation () { } - MIMetricMetaInformation:: MIMetricMetaInformation(){ @@ -63,7 +58,6 @@ MIMetricMetaInformation(){ } - void MIMetricMetaInformation ::PrintSelf(std::ostream& os, itk::Indent indent) const @@ -71,7 +65,6 @@ MIMetricMetaInformation Superclass::PrintSelf(os, indent); } - MIMetricMetaInformation ::~MIMetricMetaInformation () { @@ -86,7 +79,6 @@ NCCMetricMetaInformation(){ } - void NCCMetricMetaInformation ::PrintSelf(std::ostream& os, itk::Indent indent) const @@ -94,7 +86,6 @@ NCCMetricMetaInformation Superclass::PrintSelf(os, indent); } - NCCMetricMetaInformation ::~NCCMetricMetaInformation () { diff --git a/itkReg23DRT/itkReg23MetaInformation.h b/itkReg23DRT/itkReg23MetaInformation.h index 45d1c5c..03c3d0b 100644 --- a/itkReg23DRT/itkReg23MetaInformation.h +++ b/itkReg23DRT/itkReg23MetaInformation.h @@ -173,7 +173,6 @@ private: void operator=(const Self&); }; - class NCCMetricMetaInformation : public itk::Object{ @@ -205,8 +204,6 @@ protected: bool m_SubtractMean; - - /** Default Constructor **/ NCCMetricMetaInformation (); /** Default Destructor **/ diff --git a/itkReg23DRT/vtkContourTopogramProjectionFilter.cxx b/itkReg23DRT/vtkContourTopogramProjectionFilter.cxx index aaf143e..e9d29f1 100644 --- a/itkReg23DRT/vtkContourTopogramProjectionFilter.cxx +++ b/itkReg23DRT/vtkContourTopogramProjectionFilter.cxx @@ -53,7 +53,6 @@ vtkContourTopogramProjectionFilter::vtkContourTopogramProjectionFilter() 0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, vtkDataSetAttributes::SCALARS); } - vtkContourTopogramProjectionFilter::~vtkContourTopogramProjectionFilter() { if (this->m_Transform) @@ -111,7 +110,6 @@ int vtkContourTopogramProjectionFilter::RequestData( // If no points, then nothing to do. if (points == nullptr) { -// std::cout << "Cannot Project; no input points" << std::endl; vtkDebugMacro("Cannot Project; no input points"); return 1; } @@ -119,7 +117,6 @@ int vtkContourTopogramProjectionFilter::RequestData( // If reference transform, then nothing to do. if (m_RefTransform == nullptr) { -// std::cout << "Cannot Project; no input reference projection transform" << std::endl; vtkDebugMacro("Cannot Project; no input reference projection transform"); return 1; } @@ -127,7 +124,6 @@ int vtkContourTopogramProjectionFilter::RequestData( // If transform, then nothing to do. if (m_Transform == nullptr) { -// std::cout << "Cannot Project; no input projection transform" << std::endl; vtkDebugMacro("Cannot Project; no input projection transform"); return 1; } @@ -198,7 +194,6 @@ int vtkContourTopogramProjectionFilter::RequestData( return 1; - } void vtkContourTopogramProjectionFilter::SetImportOffsetLPS(const double * dP)