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 "mitkLookupTableSource.h" 00020 00021 mitk::LookupTableSource::LookupTableSource() 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 00032 this->ProcessObject::SetNumberOfRequiredOutputs( 1 ); 00033 this->ProcessObject::SetNthOutput( 0, output.GetPointer() ); 00034 } 00035 00036 00037 mitk::LookupTableSource::~LookupTableSource() 00038 {} 00039 00040 00041 00042 00043 mitk::LookupTableSource::DataObjectPointer 00044 mitk::LookupTableSource::MakeOutput ( unsigned int ) 00045 { 00046 return OutputType::New().GetPointer(); 00047 } 00048 00049 00050 00051 00052 void 00053 mitk::LookupTableSource::SetOutput( OutputType* output ) 00054 { 00055 itkWarningMacro( << "SetOutput(): This method is slated to be removed from ITK. Please use GraftOutput() in possible combination with DisconnectPipeline() instead." ); 00056 this->SetNthOutput( 0, output ); 00057 } 00058 00059 00060 00061 00062 mitk::LookupTableSource::OutputType* 00063 mitk::LookupTableSource::GetOutput() 00064 { 00065 if ( this->GetNumberOfOutputs() < 1 ) 00066 { 00067 return 0; 00068 } 00069 00070 if ( static_cast<OutputType*> ( this->ProcessObject::GetOutput( 0 ) ) == NULL ) 00071 itkWarningMacro(<<"Output is NULL!"); 00072 return static_cast<OutputType*> ( this->ProcessObject::GetOutput( 0 ) ); 00073 } 00074 00075 00076 00077 00078 mitk::LookupTableSource::OutputType* 00079 mitk::LookupTableSource::GetOutput ( unsigned int idx ) 00080 { 00081 return static_cast<OutputType*> ( this->ProcessObject::GetOutput( idx ) ); 00082 } 00083 00084 00085 00086 00087 void 00088 mitk::LookupTableSource::GenerateInputRequestedRegion() 00089 { 00090 this->ProcessObject::GenerateInputRequestedRegion(); 00091 } 00092 00093 00094 00095 00096 void 00097 mitk::LookupTableSource::GraftOutput( OutputType* graft ) 00098 { 00099 OutputType * output = this->GetOutput(); 00100 00101 if ( output && graft ) 00102 { 00103 // grab a handle to the bulk data of the specified data object 00104 // output->SetPixelContainer( graft->GetPixelContainer() ); 00105 00106 // copy the region ivars of the specified data object 00107 // output->SetRequestedRegion( graft->GetRequestedRegion() ); 00108 // output->SetLargestPossibleRegion( graft->GetLargestPossibleRegion() ); 00109 // output->SetBufferedRegion( graft->GetBufferedRegion() ); 00110 00111 // copy the meta-information 00112 output->CopyInformation( graft ); 00113 } 00114 }