Medical Imaging Interaction Toolkit  2018.4.99-389bf124
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "mitkLookupTableSource.h"
14 
16 {
17  // Create the output.
18  itk::DataObject::Pointer output = this->MakeOutput(0);
19  Superclass::SetNumberOfRequiredOutputs(1);
20  Superclass::SetNthOutput(0, output);
21 }
22 
24 {
25 }
26 
27 itk::DataObject::Pointer mitk::LookupTableSource::MakeOutput(DataObjectPointerArraySizeType /*idx*/)
28 {
29  return OutputType::New().GetPointer();
30 }
31 
32 itk::DataObject::Pointer mitk::LookupTableSource::MakeOutput(const DataObjectIdentifierType &name)
33 {
34  itkDebugMacro("MakeOutput(" << name << ")");
35  if (this->IsIndexedOutputName(name))
36  {
37  return this->MakeOutput(this->MakeIndexFromOutputName(name));
38  }
39  return OutputType::New().GetPointer();
40 }
41 
43 {
44  this->ProcessObject::GenerateInputRequestedRegion();
45 }
46 
48 {
49  OutputType *output = this->GetOutput();
50 
51  if (output && graft)
52  {
53  // grab a handle to the bulk data of the specified data object
54  // output->SetPixelContainer( graft->GetPixelContainer() );
55 
56  // copy the region ivars of the specified data object
57  // output->SetRequestedRegion( graft->GetRequestedRegion() );
58  // output->SetLargestPossibleRegion( graft->GetLargestPossibleRegion() );
59  // output->SetBufferedRegion( graft->GetBufferedRegion() );
60 
61  // copy the meta-information
62  output->CopyInformation(graft);
63  }
64 }
65 
67 {
68  return itkDynamicCastInDebugMode<OutputType *>(this->GetPrimaryOutput());
69 }
70 
72 {
73  return itkDynamicCastInDebugMode<const OutputType *>(this->GetPrimaryOutput());
74 }
75 
77  itk::ProcessObject::DataObjectPointerArraySizeType idx)
78 {
79  OutputType *out = dynamic_cast<OutputType *>(this->ProcessObject::GetOutput(idx));
80  if (out == nullptr && this->ProcessObject::GetOutput(idx) != nullptr)
81  {
82  itkWarningMacro(<< "Unable to convert output number " << idx << " to type " << typeid(OutputType).name());
83  }
84  return out;
85 }
86 
88  itk::ProcessObject::DataObjectPointerArraySizeType idx) const
89 {
90  const OutputType *out = dynamic_cast<const OutputType *>(this->ProcessObject::GetOutput(idx));
91  if (out == nullptr && this->ProcessObject::GetOutput(idx) != nullptr)
92  {
93  itkWarningMacro(<< "Unable to convert output number " << idx << " to type " << typeid(OutputType).name());
94  }
95  return out;
96 }
virtual void GraftOutput(OutputType *output)
static Pointer New()
void GenerateInputRequestedRegion() override
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 ...