Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkDataNodeSource.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 "mitkDataNodeSource.h"
18 
20 {
21  // Create the output.
22  OutputType::Pointer output = static_cast<OutputType *>(this->MakeOutput(0).GetPointer());
23  this->SetNthOutput(0, output.GetPointer());
24 }
25 
27 {
28 }
29 
30 itk::ProcessObject::DataObjectPointer mitk::DataNodeSource::MakeOutput(DataObjectPointerArraySizeType /*idx*/)
31 {
32  return OutputType::New().GetPointer();
33 }
34 
35 itk::ProcessObject::DataObjectPointer mitk::DataNodeSource::MakeOutput(const DataObjectIdentifierType &name)
36 {
37  itkDebugMacro("MakeOutput(" << name << ")");
38  if (this->IsIndexedOutputName(name))
39  {
40  return this->MakeOutput(this->MakeIndexFromOutputName(name));
41  }
42  return static_cast<itk::DataObject *>(OutputType::New().GetPointer());
43 }
44 
46 {
47  return itkDynamicCastInDebugMode<OutputType *>(this->GetPrimaryOutput());
48 }
49 
51 {
52  return itkDynamicCastInDebugMode<const OutputType *>(this->GetPrimaryOutput());
53 }
54 
56 {
57  return static_cast<OutputType *>(Superclass::GetOutput(idx));
58 }
59 
60 const mitk::DataNodeSource::OutputType *mitk::DataNodeSource::GetOutput(DataObjectPointerArraySizeType idx) const
61 {
62  const OutputType *out = dynamic_cast<const OutputType *>(this->ProcessObject::GetOutput(idx));
63 
64  if (out == nullptr && this->ProcessObject::GetOutput(idx) != nullptr)
65  {
66  itkWarningMacro(<< "Unable to convert output number " << idx << " to type " << typeid(OutputType).name());
67  }
68  return out;
69 }
virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.