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
00138
00140 itkStaticConstMacro(InputImageDimension, unsigned int,
00141 TInputImage::ImageDimension);
00142 itkStaticConstMacro(OutputImageDimension, unsigned int,
00143 TOutputImage::ImageDimension);
00144
00147 itkConceptMacro(SameDimension,
00148 (Concept::SameDimension<itkGetStaticConstMacro(InputImageDimension),itkGetStaticConstMacro(OutputImageDimension)>));
00149
00151 itkConceptMacro(DimensionShouldBe3,
00152 (Concept::SameDimension<itkGetStaticConstMacro(InputImageDimension),3>));
00153
00155 itkNewMacro(Self);
00156
00158 itkTypeMacro(OrientImageFilter, ImageToImageFilter);
00159
00161 itkGetMacro(GivenCoordinateOrientation, CoordinateOrientationCode);
00162 void SetGivenCoordinateOrientation(CoordinateOrientationCode newCode);
00163 itkGetMacro(DesiredCoordinateOrientation, CoordinateOrientationCode);
00164 void SetDesiredCoordinateOrientation(CoordinateOrientationCode newCode);
00165
00167 itkGetConstReferenceMacro( PermuteOrder, PermuteOrderArrayType );
00168
00170 itkGetConstReferenceMacro( FlipAxes, FlipAxesArrayType );
00171
00179 virtual void GenerateOutputInformation();
00180
00181 protected:
00182 OrientImageFilter();
00183 ~OrientImageFilter() {};
00184 void PrintSelf(std::ostream& os, Indent indent) const;
00185
00189 void GenerateInputRequestedRegion() ;
00190
00192 void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output));
00193
00194
00195 void DeterminePermutationsAndFlips(const SpatialOrientation::ValidCoordinateOrientationFlags fixed_orient, const SpatialOrientation::ValidCoordinateOrientationFlags moving_orient);
00196 bool NeedToPermute();
00197 bool NeedToFlip();
00198
00199
00202 void GenerateData();
00203
00204
00205 private:
00206 OrientImageFilter(const Self&);
00207 void operator=(const Self&);
00208
00209 CoordinateOrientationCode m_GivenCoordinateOrientation;
00210 CoordinateOrientationCode m_DesiredCoordinateOrientation;
00211
00212 PermuteOrderArrayType m_PermuteOrder;
00213 FlipAxesArrayType m_FlipAxes;
00214 } ;
00215
00216 }
00217
00218 #ifndef ITK_MANUAL_INSTANTIATION
00219 #include "itkOrientImageFilter.txx"
00220 #endif
00221
00222 #endif
00223
00224