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 #ifndef _MITK_STL_VECTOR_CONTAINER_SOURCE_TXX_ 00019 #define _MITK_STL_VECTOR_CONTAINER_SOURCE_TXX_ 00020 00021 #include "mitkSTLVectorContainerSource.h" 00022 00023 template <typename T> 00024 mitk::STLVectorContainerSource<T>::STLVectorContainerSource() 00025 { 00026 OutputTypePointer output = static_cast<OutputType*>( this->MakeOutput( 0 ).GetPointer() ); 00027 00028 assert( output.GetPointer() != NULL ); 00029 00030 this->ProcessObject::SetNumberOfRequiredOutputs( 1 ); 00031 this->ProcessObject::SetNthOutput( 0, output.GetPointer() ); 00032 } 00033 00034 00035 template <typename T> 00036 mitk::STLVectorContainerSource<T>::~STLVectorContainerSource() 00037 {} 00038 00039 00040 00041 00042 template <typename T> 00043 typename mitk::STLVectorContainerSource<T>::DataObjectPointer 00044 mitk::STLVectorContainerSource<T>::MakeOutput ( unsigned int ) 00045 { 00046 return OutputType::New().GetPointer(); 00047 } 00048 00049 00050 00051 00052 template <typename T> 00053 void 00054 mitk::STLVectorContainerSource<T>::SetOutput( OutputType* output ) 00055 { 00056 itkWarningMacro( << "SetOutput(): This method is slated to be removed from ITK. Please use GraftOutput() in possible combination with DisconnectPipeline() instead." ); 00057 this->SetNthOutput( 0, output ); 00058 } 00059 00060 00061 00062 00063 template <typename T> 00064 typename mitk::STLVectorContainerSource<T>::OutputType* 00065 mitk::STLVectorContainerSource<T>::GetOutput() 00066 { 00067 if ( this->GetNumberOfOutputs() < 1 ) 00068 { 00069 return 0; 00070 } 00071 00072 if ( static_cast<OutputType*> ( this->ProcessObject::GetOutput( 0 ) ) == NULL ) 00073 itkWarningMacro(<< "Output is NULL!" ); 00074 return static_cast<OutputType*> ( this->ProcessObject::GetOutput( 0 ) ); 00075 } 00076 00077 00078 00079 00080 template <typename T> 00081 typename mitk::STLVectorContainerSource<T>::OutputType* 00082 mitk::STLVectorContainerSource<T>::GetOutput ( unsigned int idx ) 00083 { 00084 return static_cast<OutputType*> ( this->ProcessObject::GetOutput( idx ) ); 00085 } 00086 00087 00088 00089 00090 template <typename T> 00091 void 00092 mitk::STLVectorContainerSource<T>::GenerateInputRequestedRegion() 00093 { 00094 this->ProcessObject::GenerateInputRequestedRegion(); 00095 } 00096 00097 00098 00099 00100 template <typename T> 00101 void 00102 mitk::STLVectorContainerSource<T>::GraftOutput( OutputType* graft ) 00103 { 00104 OutputType * output = this->GetOutput(); 00105 00106 if ( output && graft ) 00107 { 00108 // copy the meta-information 00109 output->CopyInformation( graft ); 00110 } 00111 } 00112 00113 00114 #endif