00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $ 00006 Version: $Revision: 17179 $ 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 "mitkSurfaceToSurfaceFilter.h" 00020 #include "mitkSurface.h" 00021 00022 mitk::SurfaceToSurfaceFilter::SurfaceToSurfaceFilter() 00023 : SurfaceSource() 00024 { 00025 } 00026 00027 mitk::SurfaceToSurfaceFilter::~SurfaceToSurfaceFilter() 00028 { 00029 } 00030 00031 00032 void mitk::SurfaceToSurfaceFilter::SetInput( const mitk::Surface* surface ) 00033 { 00034 this->SetInput( 0, const_cast<mitk::Surface*>( surface ) ); 00035 } 00036 00037 00038 void mitk::SurfaceToSurfaceFilter::SetInput( unsigned int idx, const mitk::Surface* surface ) 00039 { 00040 if ( this->GetInput(idx) != surface ) 00041 { 00042 this->SetNthInput( idx, const_cast<mitk::Surface*>( surface ) ); 00043 this->CreateOutputsForAllInputs(idx); 00044 this->Modified(); 00045 } 00046 } 00047 00048 00049 const mitk::Surface* mitk::SurfaceToSurfaceFilter::GetInput() 00050 { 00051 if (this->GetNumberOfInputs() < 1) 00052 return NULL; 00053 00054 return static_cast<const mitk::Surface*>(this->ProcessObject::GetInput(0)); 00055 } 00056 00057 00058 const mitk::Surface* mitk::SurfaceToSurfaceFilter::GetInput( unsigned int idx) 00059 { 00060 if (this->GetNumberOfInputs() < 1) 00061 return NULL; 00062 00063 return static_cast<const mitk::Surface*>(this->ProcessObject::GetInput(idx)); 00064 } 00065 00066 00067 void mitk::SurfaceToSurfaceFilter::CreateOutputsForAllInputs(unsigned int /*idx*/) 00068 { 00069 this->SetNumberOfOutputs( this->GetNumberOfInputs() ); 00070 for (unsigned int idx = 0; idx < this->GetNumberOfOutputs(); ++idx) 00071 { 00072 if (this->GetOutput(idx) == NULL) 00073 { 00074 DataObjectPointer newOutput = this->MakeOutput(idx); 00075 this->SetNthOutput(idx, newOutput); 00076 } 00077 this->GetOutput( idx )->Graft( this->GetInput( idx) ); 00078 } 00079 this->Modified(); 00080 } 00081 00082 00083 void mitk::SurfaceToSurfaceFilter::RemoveInputs(mitk::Surface* input) 00084 { 00085 this->RemoveInput(input); 00086 }