Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkLookupTableSource.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 "mitkLookupTableSource.h"
18 
20 {
21  // Create the output.
22  itk::DataObject::Pointer output = this->MakeOutput(0);
23  Superclass::SetNumberOfRequiredOutputs(1);
24  Superclass::SetNthOutput(0, output);
25 }
26 
28 {
29 }
30 
31 itk::DataObject::Pointer mitk::LookupTableSource::MakeOutput(DataObjectPointerArraySizeType /*idx*/)
32 {
33  return OutputType::New().GetPointer();
34 }
35 
37 {
38  itkDebugMacro("MakeOutput(" << name << ")");
39  if (this->IsIndexedOutputName(name))
40  {
41  return this->MakeOutput(this->MakeIndexFromOutputName(name));
42  }
43  return OutputType::New().GetPointer();
44 }
45 
47 {
48  this->ProcessObject::GenerateInputRequestedRegion();
49 }
50 
52 {
53  OutputType *output = this->GetOutput();
54 
55  if (output && graft)
56  {
57  // grab a handle to the bulk data of the specified data object
58  // output->SetPixelContainer( graft->GetPixelContainer() );
59 
60  // copy the region ivars of the specified data object
61  // output->SetRequestedRegion( graft->GetRequestedRegion() );
62  // output->SetLargestPossibleRegion( graft->GetLargestPossibleRegion() );
63  // output->SetBufferedRegion( graft->GetBufferedRegion() );
64 
65  // copy the meta-information
66  output->CopyInformation(graft);
67  }
68 }
69 
71 {
72  return itkDynamicCastInDebugMode<OutputType *>(this->GetPrimaryOutput());
73 }
74 
76 {
77  return itkDynamicCastInDebugMode<const OutputType *>(this->GetPrimaryOutput());
78 }
79 
81  itk::ProcessObject::DataObjectPointerArraySizeType idx)
82 {
83  OutputType *out = dynamic_cast<OutputType *>(this->ProcessObject::GetOutput(idx));
84  if (out == nullptr && this->ProcessObject::GetOutput(idx) != nullptr)
85  {
86  itkWarningMacro(<< "Unable to convert output number " << idx << " to type " << typeid(OutputType).name());
87  }
88  return out;
89 }
90 
92  itk::ProcessObject::DataObjectPointerArraySizeType idx) const
93 {
94  const OutputType *out = dynamic_cast<const OutputType *>(this->ProcessObject::GetOutput(idx));
95  if (out == nullptr && this->ProcessObject::GetOutput(idx) != nullptr)
96  {
97  itkWarningMacro(<< "Unable to convert output number " << idx << " to type " << typeid(OutputType).name());
98  }
99  return out;
100 }
itk::SmartPointer< Self > Pointer
virtual void GraftOutput(OutputType *output)
void GenerateInputRequestedRegion() override
virtual itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override
virtual OutputType * GetOutput()
The LookupTable class mitk wrapper for a vtkLookupTableThis class can be used to color images with a ...
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.