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 #include <vtkProperty.h> 00019 #include "mitkVtkResliceInterpolationProperty.h" 00020 00021 00022 00023 mitk::VtkResliceInterpolationProperty::VtkResliceInterpolationProperty( ) 00024 { 00025 this->AddInterpolationTypes(); 00026 this->SetValue( static_cast<IdType>( VTK_RESLICE_NEAREST ) ); 00027 } 00028 00029 00030 mitk::VtkResliceInterpolationProperty::VtkResliceInterpolationProperty( const IdType& value ) 00031 { 00032 this->AddInterpolationTypes(); 00033 if ( IsValidEnumerationValue( value ) ) 00034 { 00035 this->SetValue( value ) ; 00036 } 00037 else 00038 { 00039 this->SetValue( static_cast<IdType>( VTK_RESLICE_NEAREST ) ); 00040 } 00041 } 00042 00043 mitk::VtkResliceInterpolationProperty::VtkResliceInterpolationProperty( const std::string& value ) 00044 { 00045 this->AddInterpolationTypes(); 00046 if ( IsValidEnumerationValue( value ) ) 00047 { 00048 this->SetValue( value ); 00049 } 00050 else 00051 { 00052 this->SetValue( static_cast<IdType>( VTK_RESLICE_NEAREST ) ); 00053 } 00054 } 00055 00056 00057 int mitk::VtkResliceInterpolationProperty::GetInterpolation() 00058 { 00059 return static_cast<int>( this->GetValueAsId() ); 00060 } 00061 00062 00063 void mitk::VtkResliceInterpolationProperty::SetInterpolationToNearest() 00064 { 00065 this->SetValue( static_cast<IdType>( VTK_RESLICE_NEAREST ) ); 00066 } 00067 00068 00069 void mitk::VtkResliceInterpolationProperty::SetInterpolationToLinear() 00070 { 00071 this->SetValue( static_cast<IdType>( VTK_RESLICE_LINEAR ) ); 00072 } 00073 00074 00075 void mitk::VtkResliceInterpolationProperty::SetInterpolationToCubic() 00076 { 00077 this->SetValue( static_cast<IdType>( VTK_RESLICE_CUBIC ) ); 00078 } 00079 00080 00081 void mitk::VtkResliceInterpolationProperty::AddInterpolationTypes() 00082 { 00083 AddEnum( "Nearest", static_cast<IdType>( VTK_RESLICE_NEAREST ) ); 00084 AddEnum( "Linear", static_cast<IdType>( VTK_RESLICE_LINEAR ) ); 00085 AddEnum( "Cubic", static_cast<IdType>( VTK_RESLICE_CUBIC ) ); 00086 } 00087 00088 00089 bool mitk::VtkResliceInterpolationProperty::AddEnum( const std::string& name, const IdType& id ) 00090 { 00091 return Superclass::AddEnum( name, id ); 00092 }