00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 00019 #include "mitkDataNodeSource.h" 00020 00021 00022 mitk::DataNodeSource::DataNodeSource() 00023 { 00024 // Create the output. 00025 OutputType::Pointer output = dynamic_cast<OutputType*> ( this->MakeOutput( 0 ).GetPointer() ); 00026 assert (output.IsNotNull()); 00027 this->SetNumberOfOutputs( 1 ); 00028 this->SetOutput(0, output.GetPointer()); 00029 } 00030 00031 00032 00033 00034 mitk::DataNodeSource::~DataNodeSource() 00035 { 00036 } 00037 00038 00039 00040 00041 itk::DataObject::Pointer mitk::DataNodeSource::MakeOutput ( unsigned int /*idx*/ ) 00042 { 00043 return OutputType::New().GetPointer(); 00044 } 00045 00046 00047 00048 00049 void mitk::DataNodeSource::SetOutput( OutputType* output ) 00050 { 00051 this->itk::ProcessObject::SetNthOutput( 0, output ); 00052 } 00053 00054 00055 00056 00057 void mitk::DataNodeSource::SetOutput( unsigned int idx, OutputType* output ) 00058 { 00059 this->itk::ProcessObject::SetNthOutput(idx, output); 00060 } 00061 00062 00063 00064 00065 mitk::DataNodeSource::OutputType* mitk::DataNodeSource::GetOutput() 00066 { 00067 if ( this->GetNumberOfOutputs() < 1 ) 00068 { 00069 return 0; 00070 } 00071 else 00072 { 00073 return dynamic_cast<OutputType*> ( this->GetOutput( 0 ) ); 00074 } 00075 } 00076 00077 00078 00079 00080 mitk::DataNodeSource::OutputType* mitk::DataNodeSource::GetOutput ( unsigned int idx ) 00081 { 00082 return dynamic_cast<OutputType*> ( this->itk::ProcessObject::GetOutput( idx ) ); 00083 } 00084 00085