00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkOrientImageFilter_h
00018 #define __itkOrientImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkIOCommon.h"
00022 #include "itkPermuteAxesImageFilter.h"
00023 #include "itkFlipImageFilter.h"
00024 #include "itkSpatialOrientation.h"
00025
00026 namespace itk {
00027
00105 template<class TInputImage, class TOutputImage>
00106 class ITK_EXPORT OrientImageFilter :
00107 public ImageToImageFilter<TInputImage, TOutputImage>
00108 {
00109 public:
00111 typedef OrientImageFilter Self;
00112 typedef ImageToImageFilter<TInputImage, TOutputImage>
00113 Superclass;
00114 typedef SmartPointer<Self> Pointer;
00115 typedef SmartPointer<const Self> ConstPointer;
00116
00118 typedef TInputImage InputImageType;
00119 typedef TOutputImage OutputImageType;
00120 typedef typename InputImageType::Pointer InputImagePointer;
00121 typedef typename InputImageType::ConstPointer InputImageConstPointer;
00122 typedef typename InputImageType::RegionType InputImageRegionType;
00123 typedef typename InputImageType::PixelType InputImagePixelType;
00124 typedef typename OutputImageType::Pointer OutputImagePointer;
00125 typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
00126 typedef typename OutputImageType::RegionType OutputImageRegionType;
00127 typedef typename OutputImageType::PixelType OutputImagePixelType;
00128 typedef SpatialOrientation::ValidCoordinateOrientationFlags
00129 CoordinateOrientationCode;
00131 typedef PermuteAxesImageFilter< TInputImage > PermuterType;
00132 typedef typename PermuterType::PermuteOrderArrayType PermuteOrderArrayType;
00133
00135 typedef FlipImageFilter< TInputImage > FlipperType;
00136 typedef typename FlipperType::FlipAxesArrayType FlipAxesArrayType;
00137
00139 itkStaticConstMacro(InputImageDimension, unsigned int,
00140 TInputImage::ImageDimension);
00141 itkStaticConstMacro(OutputImageDimension, unsigned int,
00142 TOutputImage::ImageDimension);
00143
00145 itkNewMacro(Self);
00146
00148 itkTypeMacro(OrientImageFilter, ImageToImageFilter);
00149
00151 itkGetMacro(GivenCoordinateOrientation, CoordinateOrientationCode);
00152 void SetGivenCoordinateOrientation(CoordinateOrientationCode newCode);
00153 itkGetMacro(DesiredCoordinateOrientation, CoordinateOrientationCode);
00154 void SetDesiredCoordinateOrientation(CoordinateOrientationCode newCode);
00155
00157 itkGetConstReferenceMacro( PermuteOrder, PermuteOrderArrayType );
00158
00160 itkGetConstReferenceMacro( FlipAxes, FlipAxesArrayType );
00161
00169 virtual void GenerateOutputInformation();
00170
00171 protected:
00172 OrientImageFilter();
00173 ~OrientImageFilter() {};
00174 void PrintSelf(std::ostream& os, Indent indent) const;
00175
00179 void GenerateInputRequestedRegion() ;
00180
00182 void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output));
00183
00184
00185 void DeterminePermutationsAndFlips(const SpatialOrientation::ValidCoordinateOrientationFlags fixed_orient, const SpatialOrientation::ValidCoordinateOrientationFlags moving_orient);
00186 bool NeedToPermute();
00187 bool NeedToFlip();
00188
00189
00192 void GenerateData();
00193
00194
00195 private:
00196 OrientImageFilter(const Self&);
00197 void operator=(const Self&);
00198
00199 CoordinateOrientationCode m_GivenCoordinateOrientation;
00200 CoordinateOrientationCode m_DesiredCoordinateOrientation;
00201
00202 PermuteOrderArrayType m_PermuteOrder;
00203 FlipAxesArrayType m_FlipAxes;
00204 } ;
00205
00206 }
00207
00208 #ifndef ITK_MANUAL_INSTANTIATION
00209 #include "itkOrientImageFilter.txx"
00210 #endif
00211
00212 #endif
00213
00214