00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision: 10345 $ 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 "mitkUnstructuredGridSource.h" 00020 #include "mitkUnstructuredGrid.h" 00021 00022 mitk::UnstructuredGridSource::UnstructuredGridSource() 00023 { 00024 // Create the output. We use static_cast<> here because we know the default 00025 // output must be of type UnstructuredGrid 00026 mitk::UnstructuredGrid::Pointer output 00027 = static_cast<mitk::UnstructuredGrid*>(this->MakeOutput(0).GetPointer()); 00028 00029 Superclass::SetNumberOfRequiredOutputs(1); 00030 Superclass::SetNthOutput(0, output.GetPointer()); 00031 } 00032 00033 mitk::UnstructuredGridSource::~UnstructuredGridSource() 00034 { 00035 } 00036 00037 mitk::UnstructuredGridSource::DataObjectPointer mitk::UnstructuredGridSource::MakeOutput(unsigned int /*idx*/) 00038 { 00039 return static_cast<itk::DataObject*>(mitk::UnstructuredGrid::New().GetPointer()); 00040 } 00041 00042 00043 mitk::UnstructuredGrid* mitk::UnstructuredGridSource::GetOutput() 00044 { 00045 if (this->GetNumberOfOutputs() < 1) 00046 { 00047 return 0; 00048 } 00049 00050 return static_cast<mitk::UnstructuredGrid*> 00051 (this->BaseProcess::GetOutput(0)); 00052 } 00053 00054 mitk::UnstructuredGrid* mitk::UnstructuredGridSource::GetOutput(unsigned int idx) 00055 { 00056 return static_cast<mitk::UnstructuredGrid*> 00057 (this->ProcessObject::GetOutput(idx)); 00058 } 00059 00060 void mitk::UnstructuredGridSource::SetOutput(mitk::UnstructuredGrid* output) 00061 { 00062 itkWarningMacro(<< "SetOutput(): This method is slated to be removed from ITK. Please use GraftOutput() in possible combination with DisconnectPipeline() instead." ); 00063 BaseProcess::SetNthOutput(0, output); 00064 } 00065 00066 void mitk::UnstructuredGridSource::GraftOutput(mitk::UnstructuredGrid* graft) 00067 { 00068 this->GraftNthOutput(0, graft); 00069 } 00070 00071 void mitk::UnstructuredGridSource::GraftNthOutput(unsigned int idx, mitk::UnstructuredGrid *graft) 00072 { 00073 if (idx < this->GetNumberOfOutputs()) 00074 { 00075 mitk::UnstructuredGrid * output = this->GetOutput(idx); 00076 00077 if (output && graft) 00078 { 00079 // grab a handle to the bulk data of the specified data object 00080 // output->SetPixelContainer( graft->GetPixelContainer() ); @FIXME!!!! 00081 00082 // copy the region ivars of the specified data object 00083 output->SetRequestedRegion( graft );//graft->GetRequestedRegion() ); 00084 // output->SetLargestPossibleRegion( graft->GetLargestPossibleRegion() ); @FIXME!!!! 00085 // output->SetBufferedRegion( graft->GetBufferedRegion() ); @FIXME!!!! 00086 00087 // copy the meta-information 00088 output->CopyInformation( graft ); 00089 } 00090 } 00091 } 00092