Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkQBallImage.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 "mitkQBallImage.h"
18 #include "mitkImageCast.h"
19 #include "itkImage.h"
20 #include "mitkImageVtkAccessor.h"
22 #include <mitkProperties.h>
23 
25 {
26  m_RgbImage = nullptr;
27  // not needed anymore as soon as all diffusion images are identified via properties anyway
28  this->SetProperty("IsQballImage", mitk::BoolProperty::New(true));
29 }
30 
32 {
33 
34 }
35 
36 const vtkImageData* mitk::QBallImage::GetVtkImageData(int t, int n) const
37 {
38  if(m_RgbImage.IsNull())
39  ConstructRgbImage();
40  return m_RgbImage->GetVtkImageData(t,n);
41 }
42 
43 vtkImageData*mitk::QBallImage::GetVtkImageData(int t, int n)
44 {
45  if(m_RgbImage.IsNull())
46  ConstructRgbImage();
47  return m_RgbImage->GetVtkImageData(t,n);
48 }
49 
51 {
52  typedef itk::Image<itk::Vector<float,QBALL_ODFSIZE>,3> ImageType;
53  typedef itk::QBallToRgbImageFilter<ImageType> FilterType;
55 
57  mitk::CastToItkImage(this, itkvol);
58  filter->SetInput(itkvol);
59  filter->Update();
60 
61  m_RgbImage = mitk::Image::New();
62  m_RgbImage->InitializeByItk( filter->GetOutput() );
63  m_RgbImage->SetVolume( filter->GetOutput()->GetBufferPointer() );
64 }
65 
66 const vtkImageData* mitk::QBallImage::GetNonRgbVtkImageData(int t, int n) const
67 {
68  return Superclass::GetVtkImageData(t,n);
69 }
70 
71 vtkImageData* mitk::QBallImage::GetNonRgbVtkImageData(int t, int n)
72 {
73  return Superclass::GetVtkImageData(t,n);
74 }
75 
76 //
77 //void mitk::QBallImage::CopyConstruct(mitk::Image::Pointer img)
78 //{
79 // m_LargestPossibleRegion = img->GetLargestPossibleRegion();
80 // m_RequestedRegion = img->GetRequestedRegion();
81 // m_Channels.push_back(img->GetChannelData(0).GetPointer());
82 // m_Volumes.push_back(img->GetVolumeData(0).GetPointer());
83 // m_Slices.push_back(img->GetSliceData(0).GetPointer());
84 // m_Dimension = img->GetDimension();
85 // m_Dimensions = img->GetDimensions();
86 // m_PixelType = img->GetPixelType();
87 //}
88 
itk::SmartPointer< Self > Pointer
virtual const vtkImageData * GetVtkImageData(int t=0, int n=0) const override
static Pointer New()
void SetProperty(const char *propertyKey, BaseProperty *property)
map::core::discrete::Elements< 3 >::InternalImageType ImageType
mitk::Image::Pointer m_RgbImage
Image class for storing images.
Definition: mitkImage.h:76
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.
virtual const vtkImageData * GetNonRgbVtkImageData(int t=0, int n=0) const
virtual void ConstructRgbImage() const
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.