00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date: 2007-12-11 14:46:19 +0100 (Di, 11. Dez 2007) $ 00006 Version: $Revision: 13129 $ 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 "mitkPlanarFigureSource.h" 00020 00021 mitk::PlanarFigureSource::PlanarFigureSource() 00022 { 00023 // Create the output. We use static_cast<> here because we know the default 00024 // output must be of type TOutputImage 00025 //OutputType::Pointer output = static_cast<OutputType*>( this->MakeOutput( 0 ).GetPointer() ); 00026 00027 //if ( output.GetPointer() == NULL ) 00028 //{ 00029 // itkWarningMacro(<<"Output could not be created!"); 00030 //} 00031 //this->ProcessObject::SetNumberOfRequiredOutputs( 1 ); 00032 //this->ProcessObject::SetNthOutput( 0, output.GetPointer() ); 00033 } 00034 00035 00036 mitk::PlanarFigureSource::~PlanarFigureSource() 00037 {} 00038 00039 00040 mitk::PlanarFigureSource::DataObjectPointer mitk::PlanarFigureSource::MakeOutput ( unsigned int ) 00041 { 00042 return NULL; 00043 } 00044 00045 00046 void mitk::PlanarFigureSource::SetOutput( OutputType* output ) 00047 { 00048 itkWarningMacro( << "SetOutput(): This method is slated to be removed from ITK. Please use GraftOutput() in possible combination with DisconnectPipeline() instead." ); 00049 this->SetNthOutput( 0, output ); 00050 } 00051 00052 00053 mitk::PlanarFigureSource::OutputType* mitk::PlanarFigureSource::GetOutput() 00054 { 00055 if ( this->GetNumberOfOutputs() < 1 ) 00056 { 00057 return 0; 00058 } 00059 00060 if ( static_cast<OutputType*> ( this->ProcessObject::GetOutput( 0 ) ) == NULL ) 00061 itkWarningMacro(<<"Output is NULL!"); 00062 return static_cast<OutputType*> ( this->ProcessObject::GetOutput( 0 ) ); 00063 } 00064 00065 00066 mitk::PlanarFigureSource::OutputType* mitk::PlanarFigureSource::GetOutput ( unsigned int idx ) 00067 { 00068 return static_cast<OutputType*> ( this->ProcessObject::GetOutput( idx ) ); 00069 } 00070 00071 void mitk::PlanarFigureSource::GenerateInputRequestedRegion() 00072 { 00073 this->ProcessObject::GenerateInputRequestedRegion(); 00074 } 00075 00076 00077 void mitk::PlanarFigureSource::GraftOutput(itk::DataObject *graft) 00078 { 00079 this->GraftNthOutput(0, graft); 00080 } 00081 00082 00083 void mitk::PlanarFigureSource::GraftNthOutput(unsigned int idx, itk::DataObject *graft) 00084 { 00085 if ( idx >= this->GetNumberOfOutputs() ) 00086 { 00087 itkExceptionMacro(<<"Requested to graft output " << idx << 00088 " but this filter only has " << this->GetNumberOfOutputs() << " Outputs."); 00089 } 00090 00091 if ( !graft ) 00092 { 00093 itkExceptionMacro(<<"Requested to graft output with a NULL pointer object" ); 00094 } 00095 00096 itk::DataObject* output = this->GetOutput(idx); 00097 if ( !output ) 00098 { 00099 itkExceptionMacro(<<"Requested to graft output that is a NULL pointer" ); 00100 } 00101 // Call Graft on NavigationData to copy member data 00102 output->Graft( graft ); 00103 }