ITK  6.0.0
Insight Toolkit
itkOrientImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkOrientImageFilter_h
19#define itkOrientImageFilter_h
20
22#include "itkFlipImageFilter.h"
24#include <map>
25#include <string>
26
27namespace itk
28{
141template <typename TInputImage, typename TOutputImage>
142class ITK_TEMPLATE_EXPORT OrientImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
143{
144public:
145 ITK_DISALLOW_COPY_AND_MOVE(OrientImageFilter);
146
152
154 using InputImageType = TInputImage;
158 using InputImagePixelType = typename InputImageType::PixelType;
159 using OutputImageType = TOutputImage;
163 using OutputImagePixelType = typename OutputImageType::PixelType;
165
169
173
175 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
176 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
177
179 itkNewMacro(Self);
180
182 itkOverrideGetNameOfClassMacro(OrientImageFilter);
183
185 itkGetEnumMacro(GivenCoordinateOrientation, CoordinateOrientationCode);
186 void
190 inline void
192 {
193 SetGivenCoordinateOrientation(itk::SpatialOrientationAdapter().FromDirectionCosines(GivenDirection));
194 }
195
196 itkGetEnumMacro(DesiredCoordinateOrientation, CoordinateOrientationCode);
197 void
199
200 inline void
202 {
203 SetDesiredCoordinateOrientation(itk::SpatialOrientationAdapter().FromDirectionCosines(DesiredDirection));
204 }
205
212 itkBooleanMacro(UseImageDirection);
213 itkGetConstMacro(UseImageDirection, bool);
214 itkSetMacro(UseImageDirection, bool);
218 itkGetConstReferenceMacro(PermuteOrder, PermuteOrderArrayType);
219
221 itkGetConstReferenceMacro(FlipAxes, FlipAxesArrayType);
222
236 void
238 {
239 this->SetDesiredCoordinateOrientation(
241 }
242
243 void
245 {
246 this->SetDesiredCoordinateOrientation(
248 }
249
250 void
252 {
253 this->SetDesiredCoordinateOrientation(
255 }
256
264 void
266
267#ifdef ITK_USE_CONCEPT_CHECKING
268 // Begin concept checking
272 // End concept checking
273#endif
274
275protected:
277 ~OrientImageFilter() override = default;
278 void
279 PrintSelf(std::ostream & os, Indent indent) const override;
280
284 void
286
288 void
289 EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
290
291 /*** Member functions used by GenerateData: */
292 void
295
297 bool
299
301 bool
303
306 void
307 GenerateData() override;
308
309private:
310 std::string
312
313 CoordinateOrientationCode m_GivenCoordinateOrientation{
315 };
316 CoordinateOrientationCode m_DesiredCoordinateOrientation{
318 };
319 bool m_UseImageDirection{ false };
320
321 PermuteOrderArrayType m_PermuteOrder{};
322 FlipAxesArrayType m_FlipAxes{};
323
324 std::map<std::string, CoordinateOrientationCode> m_StringToCode{};
325 std::map<CoordinateOrientationCode, std::string> m_CodeToString{};
326}; // end of class
327} // end namespace itk
328
329#ifndef ITK_MANUAL_INSTANTIATION
330# include "itkOrientImageFilter.hxx"
331#endif
332
333#endif
Base class for all data objects in ITK.
Flips an image across user specified axes.
Base class for all process objects that output image data.
typename OutputImageType::PixelType OutputImagePixelType
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
typename OutputImageType::Pointer OutputImagePointer
Base class for filters that take an image as input and produce an image as output.
typename InputImageType::ConstPointer InputImageConstPointer
typename InputImageType::Pointer InputImagePointer
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::RegionType InputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Permute axes and then flip images as needed to obtain agreement in coordinateOrientation codes.
void GenerateInputRequestedRegion() override
void EnlargeOutputRequestedRegion(DataObject *) override
void SetGivenCoordinateOrientation(CoordinateOrientationCode newCode)
typename FlipperType::FlipAxesArrayType FlipAxesArrayType
void SetDesiredCoordinateOrientation(CoordinateOrientationCode newCode)
void GenerateOutputInformation() override
void SetDesiredCoordinateDirection(const typename TOutputImage::DirectionType &DesiredDirection)
std::string GetMajorAxisFromPatientRelativeDirectionCosine(double x, double y, double z)
void PrintSelf(std::ostream &os, Indent indent) const override
typename OutputImageType::ConstPointer OutputImageConstPointer
void SetGivenCoordinateDirection(const typename TInputImage::DirectionType &GivenDirection)
typename PermuterType::PermuteOrderArrayType PermuteOrderArrayType
void DeterminePermutationsAndFlips(const SpatialOrientationEnums::ValidCoordinateOrientations fixed_orient, const SpatialOrientationEnums::ValidCoordinateOrientations moving_orient)
void GenerateData() override
~OrientImageFilter() override=default
Permutes the image axes according to a user specified order.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Converts SpatialOrientationEnums to/from direction cosines.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....