Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkTensorImage.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mitkTensorImage.h"
18 #include "mitkImageDataItem.h"
19 #include "mitkImageCast.h"
20 
21 #include "itkDiffusionTensor3D.h"
23 
24 #include "vtkImageData.h"
25 
26 // #ifdef _OPENMP
27 // #include "omp.h"
28 // #endif
29 
31 {
32  m_RgbImage = nullptr;
33 }
34 
36 {
37 
38 }
39 
40 vtkImageData* mitk::TensorImage::GetVtkImageData(int t, int n)
41 {
42  if(m_RgbImage.IsNull())
43  {
44  ConstructRgbImage();
45  }
46  return m_RgbImage->GetVtkImageData(t,n);
47 }
48 
49 const vtkImageData*mitk::TensorImage::GetVtkImageData(int t, int n) const
50 {
51  if(m_RgbImage.IsNull())
52  {
53  ConstructRgbImage();
54  }
55  return m_RgbImage->GetVtkImageData(t,n);
56 }
57 
59 {
60  typedef itk::Image<itk::DiffusionTensor3D<float>,3> ImageType;
61  typedef itk::TensorToRgbImageFilter<ImageType> FilterType;
63 
65  mitk::CastToItkImage(this, itkvol);
66  filter->SetInput(itkvol);
67  filter->Update();
68 
70  image->InitializeByItk( filter->GetOutput() );
71  image->SetVolume( filter->GetOutput()->GetBufferPointer() );
72  m_RgbImage = image;
73 }
74 
75 vtkImageData* mitk::TensorImage::GetNonRgbVtkImageData(int t, int n)
76 {
77  return Superclass::GetVtkImageData(t,n);
78 }
itk::SmartPointer< Self > Pointer
virtual vtkImageData * GetVtkImageData(int t=0, int n=0) override
Get a volume at a specific time t of channel n as a vtkImageData.
virtual vtkImageData * GetNonRgbVtkImageData(int t=0, int n=0)
map::core::discrete::Elements< 3 >::InternalImageType ImageType
Image class for storing images.
Definition: mitkImage.h:76
mitk::Image::Pointer m_RgbImage
virtual void ConstructRgbImage() const
static Pointer New()
void MITKCORE_EXPORT CastToItkImage(const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
Cast an mitk::Image to an itk::Image with a specific type.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.