NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkQImageToMitkImageFilter.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 niftkQImageToMitkImageFilter_h
16 #define niftkQImageToMitkImageFilter_h
17 
18 #include <mitkCommon.h>
19 #include <mitkImageSource.h>
20 #include <itkMacro.h>
21 #include <itkImage.h>
22 #include <itkRGBPixel.h>
23 #include <itkRGBAPixel.h>
24 #include <QImage>
25 
26 #include "niftkIGIDataSourcesExports.h"
27 
28 namespace niftk
29 {
30 
36 class NIFTKIGIDATASOURCES_EXPORT QImageToMitkImageFilter : public mitk::ImageSource
37 {
38  public:
39  typedef itk::RGBPixel< unsigned char > UCRGBPixelType;
40  typedef itk::RGBPixel< unsigned short > USRGBPixelType;
41  typedef itk::RGBPixel< float > FloatRGBPixelType;
42  typedef itk::RGBPixel< double > DoubleRGBPixelType;
43 
44  typedef itk::RGBAPixel< unsigned char > UCRGBAPixelType;
45  typedef itk::RGBAPixel< unsigned short > USRGBAPixelType;
46  typedef itk::RGBAPixel< float > FloatRGBAPixelType;
47  typedef itk::RGBAPixel< double > DoubleRGBAPixelType;
48 
49  mitkClassMacro(QImageToMitkImageFilter, mitk::ImageSource)
50  itkNewMacro(QImageToMitkImageFilter)
51 
52  void SetQImage(const QImage* image);
53  itkGetMacro(QImage, const QImage*);
54 
55  OutputImageType* GetOutput();
56 
60  void SetGeometryImage ( mitk::Image::Pointer GeomImage);
61 
62 protected:
63 
64  QImageToMitkImageFilter(); // purposely hidden
65  virtual ~QImageToMitkImageFilter();
66 
67  virtual DataObjectPointer MakeOutput(unsigned int idx);
68  virtual void GenerateData() override;
69 
70 protected:
71 
72  const QImage* m_QImage;
73  mitk::Image::Pointer m_Image;
74  mitk::Image::Pointer m_GeomImage;
75 
76 private:
77 
78  template <typename TPixel, unsigned int VImageDimension>
79  static mitk::Image::Pointer ConvertQImageToMitkImage(const QImage* input, const mitk::Image::Pointer GeomImage);
80  template <typename TPixel, unsigned int VImageDimension>
81  static mitk::Image::Pointer Convert8BitQImageToMitkImage(const QImage* input, const mitk::Image::Pointer GeomImage);
82 };
83 
84 } // end namespace
85 
86 #endif
itk::RGBPixel< double > DoubleRGBPixelType
Definition: niftkQImageToMitkImageFilter.h:42
itk::RGBPixel< unsigned char > UCRGBPixelType
Definition: niftkQImageToMitkImageFilter.h:39
GLenum GLenum GLenum input
Definition: glew.h:12016
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: glew.h:4052
itk::RGBAPixel< unsigned char > UCRGBAPixelType
Definition: niftkQImageToMitkImageFilter.h:44
Definition: ReceptorMemberCommandTest.cxx:25
itk::RGBPixel< unsigned short > USRGBPixelType
Definition: niftkQImageToMitkImageFilter.h:40
A basic interface to produce a 2D Mitk image from a 2D QImage. Currently only supports a QImage with ...
Definition: niftkQImageToMitkImageFilter.h:36
itk::RGBAPixel< unsigned short > USRGBAPixelType
Definition: niftkQImageToMitkImageFilter.h:45
itk::RGBAPixel< double > DoubleRGBAPixelType
Definition: niftkQImageToMitkImageFilter.h:47
itk::RGBPixel< float > FloatRGBPixelType
Definition: niftkQImageToMitkImageFilter.h:41
Simultaneous itk::Image and itk::Array (and hence vnl_vector) class.
Definition: niftkExceptionObject.h:21
itk::RGBAPixel< float > FloatRGBAPixelType
Definition: niftkQImageToMitkImageFilter.h:46