16 #ifndef __itkShCoefficientImageExporter_cpp
17 #define __itkShCoefficientImageExporter_cpp
24 #include <itkImageRegionIterator.h>
25 #include <boost/math/special_functions.hpp>
31 template<
class PixelType,
int ShOrder >
37 template<
class PixelType,
int ShOrder >
41 if (m_InputImage.IsNull())
44 Vector<double, 4> spacing4;
45 Point<float, 4> origin4;
46 Matrix<double, 4, 4> direction4; direction4.SetIdentity();
47 ImageRegion<4> imageRegion4;
49 Vector<double, 3> spacing3 = m_InputImage->GetSpacing();
50 Point<float, 3> origin3 = m_InputImage->GetOrigin();
51 Matrix<double, 3, 3> direction3 = m_InputImage->GetDirection();
52 ImageRegion<3> imageRegion3 = m_InputImage->GetLargestPossibleRegion();
54 spacing4[0] = spacing3[0]; spacing4[1] = spacing3[1]; spacing4[2] = spacing3[2]; spacing4[3] = 1;
55 origin4[0] = origin3[0]; origin4[1] = origin3[1]; origin4[2] = origin3[2]; origin4[3] = 0;
56 for (
int r=0; r<3; r++)
57 for (
int c=0; c<3; c++)
58 direction4[r][c] = direction3[r][c];
60 imageRegion4.SetSize(0, imageRegion3.GetSize()[0]);
61 imageRegion4.SetSize(1, imageRegion3.GetSize()[1]);
62 imageRegion4.SetSize(2, imageRegion3.GetSize()[2]);
63 imageRegion4.SetSize(3, (ShOrder*ShOrder + ShOrder + 2)/2 + ShOrder );
66 m_OutputImage->SetSpacing( spacing4 );
67 m_OutputImage->SetOrigin( origin4 );
68 m_OutputImage->SetDirection( direction4 );
69 m_OutputImage->SetRegions( imageRegion4 );
70 m_OutputImage->Allocate();
71 m_OutputImage->FillBuffer(0.0);
73 typedef ImageRegionConstIterator< InputImageType > InputIteratorType;
74 InputIteratorType it(m_InputImage, m_InputImage->GetLargestPossibleRegion());
75 int numCoeffs = imageRegion4.GetSize(3);
79 CoefficientImageType::IndexType index;
80 index[0] = it.GetIndex()[0];
81 index[1] = it.GetIndex()[1];
82 index[2] = it.GetIndex()[2];
84 for (
int i=0; i<numCoeffs; i++)
87 m_OutputImage->SetPixel(index, it.Get()[i]);
96 #endif // __itkShCoefficientImageExporter_cpp
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.