NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkImageUtils.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef niftkImageUtils_h
16 #define niftkImageUtils_h
17 
18 #include "niftkCoreExports.h"
19 
20 #include <itkConversionUtils.h>
21 #include <itkSpatialOrientationAdapter.h>
22 
23 #include <mitkDataNode.h>
24 #include <mitkImage.h>
25 
26 #include "niftkImageOrientation.h"
27 
30 namespace niftk
31 {
32 
37 template<typename TPixel, unsigned int VImageDimension>
38 void
40  const itk::Image<TPixel, VImageDimension>* itkImage,
41  ImageOrientation& outputOrientation
42 );
43 
44 
49 NIFTKCORE_EXPORT ImageOrientation GetAsAcquiredOrientation(ImageOrientation defaultOrientation, const mitk::Image* image);
50 
51 
55 NIFTKCORE_EXPORT bool IsImage(const mitk::DataNode* node);
56 
57 
59 template<typename TPixel, unsigned int VImageDimension>
60 void
62  const itk::Image<TPixel, VImageDimension>* itkImage,
63  const mitk::Image* image2,
64  bool &output
65  );
66 
67 
72 NIFTKCORE_EXPORT bool ImagesHaveEqualIntensities(const mitk::Image* image1, const mitk::Image* image2);
73 
74 
76 template<typename TPixel, unsigned int VImageDimension>
77 void
79  const itk::Image<TPixel, VImageDimension>* itkImage,
80  const mitk::Image* image2,
81  bool &output
82  );
83 
84 
89 NIFTKCORE_EXPORT bool ImagesHaveSameSpatialExtent(const mitk::Image* image1, const mitk::Image* image2);
90 
91 
93 template<typename TPixel, unsigned int VImageDimension>
94 void
96  itk::Image<TPixel, VImageDimension>* itkImage,
97  float &value
98  );
99 
100 
104 NIFTKCORE_EXPORT void FillImage(mitk::Image* image, float value);
105 
106 
108 template<typename TPixel, unsigned int VImageDimension>
109 void
111  const itk::Image<TPixel, VImageDimension>* itkImage,
112  const float &lower,
113  const float &upper,
114  unsigned long int &outputCount
115  );
116 
117 
123 NIFTKCORE_EXPORT unsigned long int CountBetweenThreshold(const mitk::Image* image, float lower, float upper);
124 
125 
129 NIFTKCORE_EXPORT unsigned long int GetNumberOfVoxels(const mitk::Image* image);
130 
131 
137 NIFTKCORE_EXPORT mitk::Point3D GetMiddlePointInVoxels(const mitk::Image* image);
138 
139 
143 NIFTKCORE_EXPORT double GetVolume(const mitk::Image* image);
144 
145 
149 NIFTKCORE_EXPORT void UpdateVolumeProperty(const mitk::Image* image, mitk::DataNode* node);
150 
154 template <typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
155 void ITKCopyIntensityData(const itk::Image<TPixel1, VImageDimension1>* itkImage1,
156  itk::Image<TPixel2, VImageDimension2>* itkImage2
157  );
158 
162 NIFTKCORE_EXPORT void CopyIntensityData(const mitk::Image* input, mitk::Image* output);
163 
164 
166 template<typename TPixel, unsigned int VImageDimension>
167 void
169  const itk::Image<TPixel, VImageDimension>* itkImage,
170  const std::string& filename
171  );
172 
174 NIFTKCORE_EXPORT void DumpImage(const mitk::Image *input, const std::string& fileName);
175 
185 NIFTKCORE_EXPORT mitk::Vector3D GetXYAspectRatio(const mitk::Image::Pointer image);
186 
187 }
188 
189 #endif
double GetVolume(const mitk::Image *image)
Returns the volume of non-zero voxels in an image.
Definition: niftkImageUtils.cxx:423
bool ImagesHaveSameSpatialExtent(const mitk::Image *image1, const mitk::Image *image2)
Utility method that compares if images have the same spatial extent.
Definition: niftkImageUtils.cxx:251
void ITKImagesHaveSameSpatialExtent(const itk::Image< TPixel, VImageDimension > *itkImage, const mitk::Image *image2, bool &output)
Definition: niftkImageUtils.cxx:206
bool ImagesHaveEqualIntensities(const mitk::Image *image1, const mitk::Image *image2)
Utility method that compares if images have the same intensity values.
Definition: niftkImageUtils.cxx:169
void UpdateVolumeProperty(const mitk::Image *image, mitk::DataNode *node)
Calculates the volume of non-zero voxels in image, and creates a property "midas.volume" on the data ...
Definition: niftkImageUtils.cxx:458
mitk::Vector3D GetXYAspectRatio(const mitk::Image::Pointer image)
Utility method to calculate the aspect ratio.
Definition: niftkImageUtils.cxx:569
mitk::Point3D GetMiddlePointInVoxels(const mitk::Image *image)
Returns the middle voxel of an image.
Definition: niftkImageUtils.cxx:412
GLenum GLenum GLenum input
Definition: glew.h:12016
bool IsImage(const mitk::DataNode *node)
Simply returns true if a node contains an image, and false otherwise.
Definition: niftkImageUtils.cxx:120
ImageOrientation
Describes the different types of orientation, axial, sagittal, coronal, that can be achieved in the D...
Definition: niftkImageOrientation.h:26
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: glew.h:4052
NIFTKCORE_EXPORT unsigned long int CountBetweenThreshold(const mitk::Image *image, float lower, float upper)
Simply iterates through a whole image, counting how many intensity values are >= lower and <= upper...
Definition: niftkImageUtils.cxx:360
void ITKImagesHaveEqualIntensities(const itk::Image< TPixel, VImageDimension > *itkImage, const mitk::Image *image2, bool &output)
Definition: niftkImageUtils.cxx:134
void CopyIntensityData(const mitk::Image *input, mitk::Image *output)
Assumes same size image, and same data type, and copies data from the input image to the output image...
Definition: niftkImageUtils.cxx:488
void DumpImage(const mitk::Image *image, const std::string &fileName)
Writes the image to file.
Definition: niftkImageUtils.cxx:537
void ITKCopyIntensityData(const itk::Image< TPixel1, VImageDimension1 > *input, itk::Image< TPixel2, VImageDimension2 > *output)
ITK function to copy image data, performing C-style casting between data types.
Definition: niftkImageUtils.cxx:470
GLsizei const GLfloat * value
Definition: glew.h:1833
void FillImage(mitk::Image *image, float value)
Simply iterates through a whole image, filling it with the specified value which is cast to the appro...
Definition: niftkImageUtils.cxx:298
void ITKDumpImage(const itk::Image< TPixel, VImageDimension > *itkImage, const std::string &filename)
Writes the image to file.
Definition: niftkImageUtils.cxx:521
void ITKFillImage(itk::Image< TPixel, VImageDimension > *itkImage, float &value)
Definition: niftkImageUtils.cxx:288
void ITKCountBetweenThreshold(const itk::Image< TPixel, VImageDimension > *itkImage, const float &lower, const float &upper, unsigned long int &outputCount)
Definition: niftkImageUtils.cxx:331
unsigned long int GetNumberOfVoxels(const mitk::Image *image)
Returns the number of voxels in an image.
Definition: niftkImageUtils.cxx:395
Definition: niftkExceptionObject.h:21
GLsizei const GLcharARB ** string
Definition: glew.h:5194
void ITKGetAsAcquiredOrientation(const itk::Image< TPixel, VImageDimension > *itkImage, ImageOrientation &outputOrientation)
ITK method that given an image, returns the ImageOrientation for the XY plane.
Definition: niftkImageUtils.cxx:31
ImageOrientation GetAsAcquiredOrientation(ImageOrientation defaultOrientation, const mitk::Image *image)
Returns the ImageOrientation corresponding to the XY plane, or else returns the supplied default...
Definition: niftkImageUtils.cxx:80