Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkOrientedImageDataResample.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
4  Queen's University, Kingston, ON, Canada. All Rights Reserved.
5 
6  See COPYRIGHT.txt
7  or http://www.slicer.org/copyright/copyright.txt for details.
8 
9  Unless required by applicable law or agreed to in writing, software
10  distributed under the License is distributed on an "AS IS" BASIS,
11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  See the License for the specific language governing permissions and
13  limitations under the License.
14 
15  This file was originally developed by Csaba Pinter, PerkLab, Queen's University
16  and was supported through the Applied Cancer Research Unit program of Cancer Care
17  Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
18 
19 ==============================================================================*/
20 
21 #ifndef __vtkOrientedImageDataResample_h
22 #define __vtkOrientedImageDataResample_h
23 
24 // Segmentation includes
25 #include "vtkSegmentationCoreConfigure.h"
26 
27 #include "vtkObject.h"
28 
29 class vtkImageData;
30 class vtkMatrix4x4;
32 class vtkTransform;
33 class vtkAbstractTransform;
34 
37 class vtkSegmentationCore_EXPORT vtkOrientedImageDataResample : public vtkObject
38 {
39 public:
40  static vtkOrientedImageDataResample *New();
41  vtkTypeMacro(vtkOrientedImageDataResample,vtkObject);
42 
43  enum
44  {
47  OPERATION_MASKING
48  };
49 
57  static bool ResampleOrientedImageToReferenceGeometry(vtkOrientedImageData* inputImage, vtkMatrix4x4* referenceGeometryMatrix, vtkOrientedImageData* outputImage, bool linearInterpolation=false);
58 
68  static bool ResampleOrientedImageToReferenceOrientedImage(vtkOrientedImageData* inputImage, vtkOrientedImageData* referenceImage, vtkOrientedImageData* outputImage, bool linearInterpolation=false, bool padImage=false, vtkAbstractTransform* inputImageTransform=NULL, double backgroundValue=0);
69 
78  static void TransformOrientedImage(vtkOrientedImageData* image, vtkAbstractTransform* transform, bool geometryOnly=false, bool alwaysResample=false, bool linearInterpolation=false, double backgroundColor[4]=NULL);
79 
83  static bool MergeImage(vtkOrientedImageData* inputImage, vtkOrientedImageData* imageToAppend, vtkOrientedImageData* outputImage, int operation,
84  const int extent[6] = 0, double maskThreshold = 0, double fillValue = 1, bool *outputModified=NULL);
85 
90  static bool ModifyImage(vtkOrientedImageData* inputImage, vtkOrientedImageData* modifierImage, int operation,
91  const int extent[6] = 0, double maskThreshold = 0, double fillValue = 1);
92 
94  static bool CopyImage(vtkOrientedImageData* imageToCopy, vtkOrientedImageData* outputImage, const int extent[6]=0);
95 
97  static void PrintImageInformation(vtkImageData* imageData, ostream& os, vtkIndent indent);
98 
101  static void FillImage(vtkImageData* image, double fillValue, const int extent[6]=NULL);
102 
103 public:
105  static bool CalculateEffectiveExtent(vtkOrientedImageData* image, int effectiveExtent[6], double threshold = 0.0);
106 
109  static bool DoGeometriesMatch(vtkOrientedImageData* image1, vtkOrientedImageData* image2);
110 
112  static bool DoExtentsMatch(vtkOrientedImageData* image1, vtkOrientedImageData* image2);
113 
116  static bool DoGeometriesMatchIgnoreOrigin(vtkOrientedImageData* image1, vtkOrientedImageData* image2);
117 
120  static void TransformExtent(const int inputExtent[6], vtkAbstractTransform* inputToOutputTransform, int outputExtent[6]);
121 
124  static void TransformBounds(const double inputBounds[6], vtkAbstractTransform* inputToOutputTransform, double outputBounds[6]);
125 
127  static void TransformOrientedImageDataBounds(vtkOrientedImageData* image, vtkAbstractTransform* transform, double transformedBounds[6]);
128 
132  static bool IsEqual(vtkMatrix4x4* lhs, vtkMatrix4x4* rhs);
133 
135  static bool AreEqualWithTolerance(double a, double b) { return fabs(a - b) < 0.0001; };
136 
138  static bool GetTransformBetweenOrientedImages(vtkOrientedImageData* image1, vtkOrientedImageData* image2, vtkTransform* image1ToImage2Transform);
139 
141  static bool PadImageToContainImage(vtkOrientedImageData* inputImage, vtkOrientedImageData* containedImage, vtkOrientedImageData* outputImage, const int extent[6]);
143  static bool PadImageToContainImage(vtkOrientedImageData* inputImage, vtkOrientedImageData* containedImage, vtkOrientedImageData* outputImage);
144 
150  static bool IsTransformLinear(vtkAbstractTransform* transform, vtkTransform* linearTransform);
151 
153  static bool DoesTransformMatrixContainShear(vtkMatrix4x4* matrix);
154 
155 protected:
158 
159 private:
161  void operator=(const vtkOrientedImageDataResample&); // Not implemented.
162 };
163 
164 #endif
Utility functions for resampling oriented image data.
static bool AreEqualWithTolerance(double a, double b)
Compare two floating point numbers within tolerance.
Image data containing orientation information.