From 5a79dfb9e4860dc684c7bde0765c5de2b792891b Mon Sep 17 00:00:00 2001 From: Vivien Delmon Date: Mon, 30 May 2011 13:57:42 +0200 Subject: [PATCH] Add panel shift in y direction in Cone Beam Project - Add it in the filter. - Modify the ggo and generic filter to handle it. --- tools/clitkConeBeamProjectImage.ggo | 2 +- tools/clitkConeBeamProjectImageFilter.h | 13 +++++++++---- tools/clitkConeBeamProjectImageFilter.txx | 8 +++++--- tools/clitkConeBeamProjectImageGenericFilter.cxx | 8 ++++---- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/tools/clitkConeBeamProjectImage.ggo b/tools/clitkConeBeamProjectImage.ggo index 1c77551..4e80707 100644 --- a/tools/clitkConeBeamProjectImage.ggo +++ b/tools/clitkConeBeamProjectImage.ggo @@ -35,4 +35,4 @@ option "size" - "Size for the output image" int multiple no default="512" option "spacing" - "Spacing for the output image" double multiple no default="0.8" option "panel_position" - "Approximate position of the panel: small, medium or large" string no default="small" -option "panel_shift" - "Precise position of the panel in mm" double no +option "panel_shift" - "Precise position of the panel in mm" double multiple no diff --git a/tools/clitkConeBeamProjectImageFilter.h b/tools/clitkConeBeamProjectImageFilter.h index fcf8610..2363a5f 100644 --- a/tools/clitkConeBeamProjectImageFilter.h +++ b/tools/clitkConeBeamProjectImageFilter.h @@ -188,11 +188,16 @@ namespace clitk } /** Set the panelshift. */ - void SetPanelShift(double shift) + void SetPanelShift(double x, double y) { - if (m_PanelShift!=shift) + if (m_PanelShift[0] != x) { - m_PanelShift=shift; + m_PanelShift[0] = x; + m_IsInitialized=false; + } + if (m_PanelShift[1] != y) + { + m_PanelShift[1] = y; m_IsInitialized=false; } } @@ -229,7 +234,7 @@ namespace clitk double m_SourceToScreen; double m_SourceToAxis; double m_ProjectionAngle; - double m_PanelShift; + double m_PanelShift[2]; MatrixType m_RigidTransformMatrix; OutputPixelType m_EdgePaddingValue; diff --git a/tools/clitkConeBeamProjectImageFilter.txx b/tools/clitkConeBeamProjectImageFilter.txx index dfc8898..798fbd1 100644 --- a/tools/clitkConeBeamProjectImageFilter.txx +++ b/tools/clitkConeBeamProjectImageFilter.txx @@ -36,6 +36,8 @@ namespace clitk m_IsoCenter.Fill(0.0); m_SourceToScreen=1536.; m_SourceToAxis=1000.; + m_PanelShift[0] = 0.; + m_PanelShift[1] = 0.; m_ProjectionAngle=0.; m_RigidTransformMatrix.SetIdentity(); m_EdgePaddingValue=itk::NumericTraits::Zero;//density images @@ -163,15 +165,15 @@ namespace clitk spacingOutput[1] = m_OutputSpacing[0]; // pixel spacing along Y of the 2D DRR image [mm] spacingOutput[2] = m_OutputSpacing[1]; // pixel spacing along Y of the 2D DRR image [mm] m_Resampler->SetOutputSpacing( spacingOutput ); - if (m_Verbose)std::cout<<"The output size is "<< m_OutputSpacing <<"..."<< std::endl; + if (m_Verbose)std::cout<<"The output spacing is "<< m_OutputSpacing <<"..."<< std::endl; // The position of the DRR is specified, we presume that for an angle of 0° the flatpanel is located at the negative x-axis // JV -1 seems to correspond better with shearwarp of Simon Rit typename InterpolatorType::InputPointType originOutput; originOutput[0] = m_IsoCenter[0]- (m_SourceToScreen - m_SourceToAxis); DD(m_PanelShift); - originOutput[1] = m_IsoCenter[1]-static_cast(sizeOuput[1]-1)*spacingOutput[1]/2.0 - m_PanelShift; - originOutput[2] = m_IsoCenter[2]-static_cast(sizeOuput[2]-1)*spacingOutput[2]/2.0; + originOutput[1] = m_IsoCenter[1]-static_cast(sizeOuput[1]-1)*spacingOutput[1]/2.0 - m_PanelShift[0]; + originOutput[2] = m_IsoCenter[2]-static_cast(sizeOuput[2]-1)*spacingOutput[2]/2.0 - m_PanelShift[1]; m_Resampler->SetOutputOrigin( originOutput ); if (m_Verbose)std::cout<<"The origin of the flat panel is at "<< originOutput <<",..."<< std::endl; diff --git a/tools/clitkConeBeamProjectImageGenericFilter.cxx b/tools/clitkConeBeamProjectImageGenericFilter.cxx index d659b96..e36b7d1 100644 --- a/tools/clitkConeBeamProjectImageGenericFilter.cxx +++ b/tools/clitkConeBeamProjectImageGenericFilter.cxx @@ -133,14 +133,14 @@ namespace clitk DD(m_ArgsInfo.panel_position_arg); if (m_ArgsInfo.panel_shift_given) // one should read the specific values for each angle in Frame.dbf - filter->SetPanelShift(m_ArgsInfo.panel_shift_arg); + filter->SetPanelShift(m_ArgsInfo.panel_shift_arg[0], m_ArgsInfo.panel_shift_arg[1]); else { // approximate panel positions hard coded values for the elekta synergy if (strcmp(m_ArgsInfo.panel_position_arg,"small") ==0) - filter->SetPanelShift(0.); + filter->SetPanelShift(0., 0.); else if (strcmp(m_ArgsInfo.panel_position_arg,"medium") ==0) - filter->SetPanelShift(114.84); + filter->SetPanelShift(114.84, 0.); // VD : 120 , 0 ? else if (strcmp(m_ArgsInfo.panel_position_arg,"large") ==0) - filter->SetPanelShift(190.); + filter->SetPanelShift(190., 0.); else assert(false); //Unsupported panel position } // Output image info -- 2.45.1