template<typename TInputImage, typename TOutputImage>
class itk::OrientImageFilter< TInputImage, TOutputImage >
Permute axes and then flip images as needed to obtain agreement in coordinateOrientation codes.
This class satisfies a common requirement in medical imaging, which is to properly orient a 3 dimensional image with respect to anatomical features. Due to the wide variety of hardware used to generate 3D images of human anatomy, and the even wider variety of image processing software, it is often necessary to re-orient image volume data.
OrientImageFilter depends on a set of constants that describe all possible labeled according to the following scheme: Directions are labeled in terms of following pairs:
- Left and Right (Subject's left and right)
- Anterior and Posterior (Subject's front and back)
- Inferior and Superior (Subject's bottom and top, i.e. feet and head)
The initials of these directions are used in a 3 letter code in the enumerated type itk::SpatialOrientation::ValidCoordinateOrientationFlags. The initials are given fastest moving index first, second fastest second, third fastest third. Examples:
- ITK_COORDINATE_ORIENTATION_RIP
- Right to Left varies fastest (0th pixel on Subject's right)
- Inferior to Superior varies second fastest
- Posterior to Anterior varies slowest.
- ITK_COORDINATE_ORIENTATION_LSA
- Left to Right varies fastest (0th pixel on Subject's left)
- Superior to Inferior varies second fastest
- Anterior to Posterior varies slower
In order to use this filter, you need to supply an input image, the current orientation of the input image (set with SetGivenCoordinateOrientation) and the desired orientation. (set with SetDesiredCoordinateOrientation). You may explicitly set the DesiredOrientation with SetDesiredCoordinateOrientation (if UseImageDirection is "off") or you can use the image's direction cosines to set the DesiredOrientation (if UseImageDirection is "on"). When reading image files that define the coordinate orientation of the image, the current orientation is stored in the MetadataDictionary for the itk::Image object and the Image.Direction direction cosine matrix created from the file.
As an example, if you wished to keep all images within your program in the orientation corresponding to the Analyze file format's 'CORONAL' orientation you could do something like the following
*
*
* #include "itkAnalyzeImageIO.h"
* #include "itkMetaDataObject.h"
* #include "itkImage.h"
* #include "itkOrientImageFilter.h"
* ImageType::Pointer ReadAnalyzeFile(const char *path)
* {
* itk::AnalyzeImageIO::Pointer io = itk::AnalyzeImageIO::New();
* ImageReaderType::Pointer fileReader = ImageReaderType::New();
* fileReader->SetImageIO(io);
* fileReader->SetFileName(path);
* fileReader->Update();
* ImageType::Pointer rval = fileReader->GetOutput();
*
* Deprecated -- use direction cosines
* itk::ExposeMetaData<itk::SpatialOrientation::ValidCoordinateOrientationFlags>
* (rval->GetMetaDataDictionary(),itk::ITK_CoordinateOrientation,fileOrientation);
* orienter->SetGivenCoordinateOrientation(fileOrientation);
*
* orienter->SetInput(rval);
* orienter->Update();
* rval = orienter->GetOutput();
* return rval;
* }
*
Or, using the direction cosines of the image,
* #include "itkAnalyzeImageIO.h"
* #include "itkImage.h"
* #include "itkOrientImageFilter.h"
* ImageType::Pointer ReadAnalyzeFile(const char *path)
* {
* itk::AnalyzeImageIO::Pointer io = itk::AnalyzeImageIO::New();
* ImageReaderType::Pointer fileReader = ImageReaderType::New();
* fileReader->SetImageIO(io);
* fileReader->SetFileName(path);
* fileReader->Update();
* ImageType::Pointer rval = fileReader->GetOutput();
*
* orienter->UseImageDirectionOn();
* orienter->SetInput(rval);
* orienter->Update();
* rval = orienter->GetOutput();
* return rval;
* }
*
Definition at line 140 of file itkOrientImageFilter.h.
|
void | DeterminePermutationsAndFlips (const SpatialOrientation::ValidCoordinateOrientationFlags fixed_orient, const SpatialOrientation::ValidCoordinateOrientationFlags moving_orient) |
|
void | EnlargeOutputRequestedRegion (DataObject *) |
|
void | GenerateData () |
|
void | GenerateInputRequestedRegion () |
|
bool | NeedToFlip () |
|
bool | NeedToPermute () |
|
| OrientImageFilter () |
|
void | PrintSelf (std::ostream &os, Indent indent) const |
|
| ~OrientImageFilter () |
|
virtual void | CallCopyInputRegionToOutputRegion (OutputImageRegionType &destRegion, const InputImageRegionType &srcRegion) |
|
virtual void | CallCopyOutputRegionToInputRegion (InputImageRegionType &destRegion, const OutputImageRegionType &srcRegion) |
|
| ImageToImageFilter () |
|
virtual void | VerifyInputInformation () |
|
| ~ImageToImageFilter () |
|
void | PushBackInput (const DataObject *input) |
|
void | PushFrontInput (const DataObject *input) |
|
virtual void | AfterThreadedGenerateData () |
|
virtual void | AllocateOutputs () |
|
virtual void | BeforeThreadedGenerateData () |
|
virtual const
ImageRegionSplitterBase * | GetImageRegionSplitter (void) const |
|
| ImageSource () |
|
virtual unsigned int | SplitRequestedRegion (unsigned int i, unsigned int pieces, OutputImageRegionType &splitRegion) |
|
virtual void | ThreadedGenerateData (const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) |
|
virtual | ~ImageSource () |
|
virtual void | AddInput (DataObject *input) |
|
virtual void | AddOutput (DataObject *output) |
|
virtual void | CacheInputReleaseDataFlags () |
|
virtual void | GenerateOutputRequestedRegion (DataObject *output) |
|
virtual const
DataObjectPointerArraySizeType & | GetNumberOfRequiredOutputs () const |
|
bool | IsIndexedInputName (const DataObjectIdentifierType &) const |
|
bool | IsIndexedOutputName (const DataObjectIdentifierType &) const |
|
| itkLegacyMacro (virtual void RemoveOutput(DataObject *output)) |
|
| itkLegacyMacro (void SetNumberOfOutputs(DataObjectPointerArraySizeType num)) |
|
| itkLegacyMacro (virtual void RemoveInput(DataObject *input)) |
|
| itkLegacyMacro (void SetNumberOfInputs(DataObjectPointerArraySizeType num)) |
|
DataObjectPointerArraySizeType | MakeIndexFromInputName (const DataObjectIdentifierType &name) const |
|
DataObjectPointerArraySizeType | MakeIndexFromOutputName (const DataObjectIdentifierType &name) const |
|
DataObjectIdentifierType | MakeNameFromInputIndex (DataObjectPointerArraySizeType idx) const |
|
DataObjectIdentifierType | MakeNameFromOutputIndex (DataObjectPointerArraySizeType idx) const |
|
| ProcessObject () |
|
virtual void | PropagateResetPipeline () |
|
virtual void | ReleaseInputs () |
|
virtual void | RemoveInput (const DataObjectIdentifierType &key) |
|
virtual void | RemoveInput (DataObjectPointerArraySizeType) |
|
virtual void | RemoveOutput (const DataObjectIdentifierType &key) |
|
virtual void | RemoveOutput (DataObjectPointerArraySizeType idx) |
|
virtual void | RestoreInputReleaseDataFlags () |
|
virtual void | SetInput (const DataObjectIdentifierType &key, DataObject *input) |
|
virtual void | SetNthInput (DataObjectPointerArraySizeType num, DataObject *input) |
|
virtual void | SetNthOutput (DataObjectPointerArraySizeType num, DataObject *output) |
|
void | SetNumberOfIndexedInputs (DataObjectPointerArraySizeType num) |
|
void | SetNumberOfIndexedOutputs (DataObjectPointerArraySizeType num) |
|
virtual void | SetNumberOfRequiredOutputs (DataObjectPointerArraySizeType _arg) |
|
virtual void | SetOutput (const DataObjectIdentifierType &key, DataObject *output) |
|
virtual void | SetPrimaryInput (DataObject *input) |
|
virtual void | SetPrimaryOutput (DataObject *output) |
|
virtual void | VerifyPreconditions () |
|
| ~ProcessObject () |
|
DataObject * | GetInput (const DataObjectIdentifierType &key) |
|
const DataObject * | GetInput (const DataObjectIdentifierType &key) const |
|
DataObject * | GetInput (DataObjectPointerArraySizeType idx) |
|
const DataObject * | GetInput (DataObjectPointerArraySizeType idx) const |
|
DataObject * | GetPrimaryInput () |
|
const DataObject * | GetPrimaryInput () const |
|
virtual void | SetPrimaryInputName (const DataObjectIdentifierType &key) |
|
virtual const char * | GetPrimaryInputName (void) const |
|
virtual void | SetNumberOfRequiredInputs (DataObjectPointerArraySizeType) |
|
virtual const
DataObjectPointerArraySizeType & | GetNumberOfRequiredInputs () const |
|
bool | AddRequiredInputName (const DataObjectIdentifierType &) |
|
bool | AddRequiredInputName (const DataObjectIdentifierType &, DataObjectPointerArraySizeType idx) |
|
bool | RemoveRequiredInputName (const DataObjectIdentifierType &) |
|
bool | IsRequiredInputName (const DataObjectIdentifierType &) const |
|
void | SetRequiredInputNames (const NameArray &) |
|
DataObject * | GetOutput (const DataObjectIdentifierType &key) |
|
const DataObject * | GetOutput (const DataObjectIdentifierType &key) const |
|
virtual void | SetPrimaryOutputName (const DataObjectIdentifierType &key) |
|
virtual const char * | GetPrimaryOutputName (void) const |
|
DataObject * | GetOutput (DataObjectPointerArraySizeType idx) |
|
const DataObject * | GetOutput (DataObjectPointerArraySizeType idx) const |
|
DataObject * | GetPrimaryOutput () |
|
const DataObject * | GetPrimaryOutput () const |
|
| Object () |
|
bool | PrintObservers (std::ostream &os, Indent indent) const |
|
virtual void | SetTimeStamp (const TimeStamp &time) |
|
virtual | ~Object () |
|
virtual LightObject::Pointer | InternalClone () const |
|
| LightObject () |
|
virtual void | PrintHeader (std::ostream &os, Indent indent) const |
|
virtual void | PrintTrailer (std::ostream &os, Indent indent) const |
|
virtual | ~LightObject () |
|