Page MenuHomePhabricator

TransferFunctionChanges.patch

Authored By
vongruen
Jun 30 2010, 3:05 PM
Size
23 KB
Referenced Files
None
Subscribers
None

TransferFunctionChanges.patch

Index: mitkTransferFunction.cpp
===================================================================
--- mitkTransferFunction.cpp (revision 24126)
+++ mitkTransferFunction.cpp (working copy)
@@ -19,6 +19,8 @@
#include "mitkImageToItk.h"
#include "mitkHistogramGenerator.h"
+#include "mitkTransferFunctionModeCreator.h"
+
#include <itkRGBPixel.h>
#include <vector>
@@ -299,263 +301,12 @@
void TransferFunction::SetTransferFunctionMode( int mode )
{
- //Define Transfer Function
- enum TransferFunctionMode{
- TF_CT_DEFAULT,
- TF_CT_BLACK_WHITE,
- TF_CT_THORAX_LARGE,
- TF_CT_THORAX_SMALL,
- TF_CT_BONE,
- TF_CT_BONE_GRADIENT,
- TF_CT_CARDIAC,
- TF_MR_GENERIC
- };
+ mitk::TransferFunctionModeCreator::Pointer modeCreator =
+ mitk::TransferFunctionModeCreator::New(mode, m_ScalarOpacityFunction,
+ m_ColorTransferFunction,
+ m_GradientOpacityFunction);
- //remove all old points
- m_ScalarOpacityFunction->RemoveAllPoints();
- m_ColorTransferFunction->RemoveAllPoints();
- m_GradientOpacityFunction->RemoveAllPoints();
+ modeCreator->InitTransferFunctionMode();
- switch( mode )
- {
- case ( TF_CT_DEFAULT ):
- /*
- // grayvalue->opacity
- {
- vtkPiecewiseFunction *f=m_ScalarOpacityFunction;
- f->AddPoint(135.063521,0.000000);
- f->AddPoint(180.498182,0.027847);
- f->AddPoint(948.137931,1.000000);
- }
-
- // gradient at grayvalue->opacity
- {
- vtkPiecewiseFunction *f=m_GradientOpacityFunction;
- f->AddPoint(560.695000,1.000000);
- }
-
- // grayvalue->color
- {
- vtkColorTransferFunction *f=m_ColorTransferFunction;
- f->AddRGBPoint( -24.956443,0.650980,0.000000,0.000000);
- f->AddRGBPoint( 208.586207,0.972549,0.227451,0.160784);
- f->AddRGBPoint( 238.860254,0.980392,0.352941,0.145098);
- f->AddRGBPoint( 279.903212,1.000000,0.858824,0.149020);
- f->AddRGBPoint( 355.631579,1.000000,0.647059,0.152941);
- f->AddRGBPoint( 455.103448,1.000000,1.000000,1.000000);
- f->AddRGBPoint( 623.773140,1.000000,0.800000,0.396078);
- f->AddRGBPoint( 796.767695,1.000000,0.901961,0.815686);
- f->AddRGBPoint( 930.838475,1.000000,1.000000,1.000000);
- f->AddRGBPoint(1073.558984,1.000000,0.839216,0.423529);
- f->AddRGBPoint(1220.604356,1.000000,0.772549,0.490196);
- }
- */
- // grayvalue->opacity
- {
- vtkPiecewiseFunction *f=m_ScalarOpacityFunction;
- f->AddPoint(132.108911,0.000000);
- f->AddPoint(197.063492,0.041333);
- f->AddPoint(1087.917989,0.700000);
- }
-
- // gradient at grayvalue->opacity
- {
- vtkPiecewiseFunction *f=m_GradientOpacityFunction;
- f->AddPoint(560.695000,1.000000);
- }
-
- // grayvalue->color
- {
- vtkColorTransferFunction *f=m_ColorTransferFunction;
- f->AddRGBPoint(176.881890,0.650980,0.000000,0.000000);
- f->AddRGBPoint(239.427822,0.933333,0.000000,0.000000);
- f->AddRGBPoint(301.973753,1.000000,0.800000,0.062745);
- f->AddRGBPoint(495.866142,1.000000,0.905882,0.666667);
- f->AddRGBPoint(677.249344,1.000000,0.882353,0.215686);
- f->AddRGBPoint(808.595801,1.000000,1.000000,1.000000);
- }
-
- break;
-
- case ( TF_CT_BLACK_WHITE ):
-
- //Set Opacity
- m_ScalarOpacityFunction->AddPoint( 135.063521, 0.0 );
- m_ScalarOpacityFunction->AddPoint( 948.137931, 1.0 );
-
-
- //Set Color
- m_ColorTransferFunction->AddRGBPoint( 122.088929, 0.352941, 0.352941, 0.352941);
- m_ColorTransferFunction->AddRGBPoint( 372.931034, 1.000000, 1.000000, 1.000000 );
-
- //Set Gradient
- m_GradientOpacityFunction->Initialize();
- m_GradientOpacityFunction->AddPoint( 560.695000, 1);
-
- break;
-
- case ( TF_CT_THORAX_LARGE ):
-
- // grayvalue->opacity
- {
- vtkPiecewiseFunction *f=m_ScalarOpacityFunction;
- f->AddPoint(76.721239,0.000000);
- f->AddPoint(139.524336,0.000000);
- f->AddPoint(274.458333,0.228650);
- f->AddPoint(638.420139,0.721763);
- }
-
- // gradient at grayvalue->opacity
- {
- vtkPiecewiseFunction *f=m_GradientOpacityFunction;
- f->AddPoint(560.695000,1.000000);
- }
- // grayvalue->color
- {
- vtkColorTransferFunction *f=m_ColorTransferFunction;
- f->AddRGBPoint( 85.382743,0.478431,0.000000,0.000000);
- f->AddRGBPoint( 198.201327,0.933333,0.000000,0.000000);
- f->AddRGBPoint( 254.610619,1.000000,0.800000,0.062745);
- f->AddRGBPoint( 336.0907085,1.000000,0.905882,0.666667);
- f->AddRGBPoint( 630.672566,1.000000,1.000000,1.000000);
- }
- break;
-
- case ( TF_CT_THORAX_SMALL ):
-
- // grayvalue->opacity
- {
- vtkPiecewiseFunction *f=m_ScalarOpacityFunction;
- f->AddPoint(147.216912,0.000000);
- f->AddPoint(274.458333,0.228650);
- f->AddPoint(430.330882,0.675532);
- }
-
- // gradient at grayvalue->opacity
- {
- vtkPiecewiseFunction *f=m_GradientOpacityFunction;
- f->AddPoint(560.695000,1.000000);
- }
-
- // grayvalue->color
- {
- vtkColorTransferFunction *f=m_ColorTransferFunction;
- f->AddRGBPoint( 129.607774,0.478431,0.000000,0.000000);
- f->AddRGBPoint( 213.812721,0.933333,0.000000,0.000000);
- f->AddRGBPoint( 348.540636,1.000000,0.800000,0.062745);
- f->AddRGBPoint( 500.419118,1.000000,0.898039,0.776471);
- f->AddRGBPoint( 579.268382,1.000000,1.000000,1.000000);
- }
- break;
-
- case ( TF_CT_BONE ):
-
- // grayvalue->opacity
- {
- vtkPiecewiseFunction *f=m_ScalarOpacityFunction;
- f->AddPoint(126.413793,0.000000);
- f->AddPoint(178.312160,0.014663);
- f->AddPoint(247.509982,0.000000);
- f->AddPoint(1013.010889,1.000000);
- }
- // gradient at grayvalue->opacity
- {
- vtkPiecewiseFunction *f=m_GradientOpacityFunction;
- f->AddPoint(485.377495,1.000000);
- }
- // grayvalue->color
- {
- vtkColorTransferFunction *f=m_ColorTransferFunction;
- f->AddRGBPoint( 312.382940,1.000000,0.564706,0.274510);
- f->AddRGBPoint( 455.103448,1.000000,0.945098,0.768627);
- f->AddRGBPoint( 623.773140,1.000000,0.800000,0.333333);
- f->AddRGBPoint( 796.767695,1.000000,0.901961,0.815686);
- f->AddRGBPoint( 930.838475,1.000000,1.000000,1.000000);
- f->AddRGBPoint(1073.558984,1.000000,0.839216,0.423529);
- f->AddRGBPoint(1220.604356,1.000000,0.772549,0.490196);
- }
- break;
-
- case ( TF_CT_BONE_GRADIENT ):
-
- // grayvalue->opacity
- {
- vtkPiecewiseFunction *f=m_ScalarOpacityFunction;
- f->AddPoint(126.413793,0.000000);
- f->AddPoint(186.961887,0.146628);
- f->AddPoint(247.509982,0.000000);
- f->AddPoint(1013.010889,1.000000);
- }
- // gradient at grayvalue->opacity
- {
- vtkPiecewiseFunction *f=m_GradientOpacityFunction;
- f->AddPoint(22.617060,0.000000);
- f->AddPoint(65.865699,1.000000);
- }
- // grayvalue->color
- {
- vtkColorTransferFunction *f=m_ColorTransferFunction;
- f->AddRGBPoint( 312.382940,1.000000,0.564706,0.274510);
- f->AddRGBPoint( 455.103448,1.000000,0.945098,0.768627);
- f->AddRGBPoint( 623.773140,1.000000,0.800000,0.333333);
- f->AddRGBPoint( 796.767695,1.000000,0.901961,0.815686);
- f->AddRGBPoint( 930.838475,1.000000,1.000000,1.000000);
- f->AddRGBPoint(1073.558984,1.000000,0.839216,0.423529);
- f->AddRGBPoint(1220.604356,1.000000,0.772549,0.490196);
- }
- break;
-
- case ( TF_CT_CARDIAC ):
-
- //Set Opacity
- m_ScalarOpacityFunction->AddPoint( 150.246824, 0.000000 );
- m_ScalarOpacityFunction->AddPoint( 179.974592, 0.202346);
- m_ScalarOpacityFunction->AddPoint( 276.589837, 0.000000);
- m_ScalarOpacityFunction->AddPoint( 781.961887, 1.000000);
-
- //Set Color
- m_ColorTransferFunction->AddRGBPoint( 395.500907,1.000000,0.000000,0.000000);
- m_ColorTransferFunction->AddRGBPoint( 410.364791,1.000000,0.749020,0.000000);
- m_ColorTransferFunction->AddRGBPoint( 484.684211,1.000000,0.878431,0.662745);
- m_ColorTransferFunction->AddRGBPoint( 588.731397,1.000000,0.784314,0.482353);
-
- //Set Gradient
- m_GradientOpacityFunction->AddPoint( 246.862069, 0.215827 );
-
- break;
-
- case ( TF_MR_GENERIC ):
-
- //Set Opacity
- m_ScalarOpacityFunction->AddPoint( 0, 0 );
- m_ScalarOpacityFunction->AddPoint( 20, 0 );
- m_ScalarOpacityFunction->AddPoint( 40, 0.15 );
- m_ScalarOpacityFunction->AddPoint( 120, 0.3 );
- m_ScalarOpacityFunction->AddPoint( 220, 0.375 );
- m_ScalarOpacityFunction->AddPoint( 1024, 0.5);
-
- //Set Color
- m_ColorTransferFunction->AddRGBPoint( 0, 0, 0, 0 );
- m_ColorTransferFunction->AddRGBPoint( 20, 0.168627, 0, 0 );
- m_ColorTransferFunction->AddRGBPoint( 40, 0.403922, 0.145098, 0.0784314 );
- m_ColorTransferFunction->AddRGBPoint( 120, 0.780392, 0.607843, 0.380392 );
- m_ColorTransferFunction->AddRGBPoint( 220, 0.847059, 0.835294, 0.788235 );
- m_ColorTransferFunction->AddRGBPoint( 1024, 1, 1, 1 );
-
- //Set Gradient
- m_GradientOpacityFunction->AddPoint( 0, 1 );
- m_GradientOpacityFunction->AddPoint( 255, 1);
-
- break;
-
-
- default:
-
- break;
- }
-
- m_ScalarOpacityFunction->Modified();
- m_ColorTransferFunction->Modified();
- m_GradientOpacityFunction->Modified();
}
-} // namespace
+}// namespace
\ No newline at end of file
Index: mitkTransferFunctionModeCreator.cpp
===================================================================
--- mitkTransferFunctionModeCreator.cpp (revision 0)
+++ mitkTransferFunctionModeCreator.cpp (revision 0)
@@ -0,0 +1,281 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2010-05-10 18:06:04 +0200 (Mo, 10 Mai 2010) $
+Version: $Revision: 22790 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "mitkTransferFunctionModeCreator.h"
+
+
+namespace mitk
+{
+
+ TransferFunctionModeCreator::TransferFunctionModeCreator(int mode,
+ vtkPiecewiseFunction* scalarOpacityFunction,
+ vtkColorTransferFunction* colorTransferFunction,
+ vtkPiecewiseFunction* gradientOpacityFunction)
+{
+ this->m_Mode = mode;
+ this->m_ScalarOpacityFunction = scalarOpacityFunction;
+ this->m_ColorTransferFunction = colorTransferFunction;
+ this->m_GradientOpacityFunction = gradientOpacityFunction;
+}
+
+TransferFunctionModeCreator::~TransferFunctionModeCreator()
+{
+
+
+}
+
+void TransferFunctionModeCreator::SetMode( int mode )
+{
+ m_Mode = mode;
+}
+
+void TransferFunctionModeCreator::SetScalarOpacityFunction( vtkPiecewiseFunction* scalarOpacityFunction )
+{
+ this->m_ScalarOpacityFunction = scalarOpacityFunction;
+
+}
+
+void TransferFunctionModeCreator::SetColorTransferFunction( vtkColorTransferFunction* colorTransferFunction)
+{
+ this->m_ColorTransferFunction = colorTransferFunction;
+}
+
+void TransferFunctionModeCreator::SetGradientOpacityFunction( vtkPiecewiseFunction* gradientOpacityFunction)
+{
+ this->m_GradientOpacityFunction = gradientOpacityFunction;
+}
+
+void TransferFunctionModeCreator::RemoveAllPoints()
+{
+ m_ScalarOpacityFunction->RemoveAllPoints();
+ m_ColorTransferFunction->RemoveAllPoints();
+ m_GradientOpacityFunction->RemoveAllPoints();
+}
+
+void TransferFunctionModeCreator::SetModified()
+{
+ m_ScalarOpacityFunction->Modified();
+ m_ColorTransferFunction->Modified();
+ m_GradientOpacityFunction->Modified();
+}
+
+void TransferFunctionModeCreator::InitTransferFunctionMode()
+{
+ this->RemoveAllPoints();
+ switch( this->m_Mode )
+ {
+ case TF_CT_DEFAULT:
+ this->SetCtDefaultMode();
+ break;
+
+ case TF_CT_BLACK_WHITE:
+ this->SetCtBlackWhiteMode();
+ break;
+
+ case TF_CT_THORAX_LARGE:
+ this->SetCtThoraxLargeMode();
+ break;
+
+ case TF_CT_THORAX_SMALL:
+ this->SetCtThoraxSmallMode();
+ break;
+
+ case TF_CT_BONE:
+ this->SetCtBoneMode();
+ break;
+
+ case TF_CT_BONE_GRADIENT:
+ this->SetCtBoneGradientMode();
+ break;
+
+ case TF_CT_CARDIAC:
+ this->SetCtCardiacMode();
+ break;
+
+ case TF_MR_GENERIC:
+ this->SetMrGenericMode();
+ break;
+
+ default:
+ break;
+ }
+
+ this->SetModified();
+}
+
+void TransferFunctionModeCreator::SetCtDefaultMode()
+{
+ // grayvalue->opacity
+ m_ScalarOpacityFunction->AddPoint(132.108911,0.000000);
+ m_ScalarOpacityFunction->AddPoint(197.063492,0.041333);
+ m_ScalarOpacityFunction->AddPoint(1087.917989,0.700000);
+
+ // gradient at grayvalue->opacity
+ m_GradientOpacityFunction->AddPoint(560.695000,1.000000);
+
+ // grayvalue->color
+ m_ColorTransferFunction->AddRGBPoint(176.881890,0.650980,0.000000,0.000000);
+ m_ColorTransferFunction->AddRGBPoint(239.427822,0.933333,0.000000,0.000000);
+ m_ColorTransferFunction->AddRGBPoint(301.973753,1.000000,0.800000,0.062745);
+ m_ColorTransferFunction->AddRGBPoint(495.866142,1.000000,0.905882,0.666667);
+ m_ColorTransferFunction->AddRGBPoint(677.249344,1.000000,0.882353,0.215686);
+ m_ColorTransferFunction->AddRGBPoint(808.595801,1.000000,1.000000,1.000000);
+}
+
+void TransferFunctionModeCreator::SetCtBlackWhiteMode()
+{
+ //Set Opacity
+ m_ScalarOpacityFunction->AddPoint( 135.063521, 0.0 );
+ m_ScalarOpacityFunction->AddPoint( 948.137931, 1.0 );
+
+
+ //Set Color
+ m_ColorTransferFunction->AddRGBPoint( 122.088929, 0.352941, 0.352941, 0.352941);
+ m_ColorTransferFunction->AddRGBPoint( 372.931034, 1.000000, 1.000000, 1.000000 );
+
+ //Set Gradient
+ m_GradientOpacityFunction->Initialize();
+ m_GradientOpacityFunction->AddPoint( 560.695000, 1);
+
+}
+
+void TransferFunctionModeCreator::SetCtThoraxLargeMode()
+{
+ // grayvalue->opacity
+
+ m_ScalarOpacityFunction->AddPoint(76.721239,0.000000);
+ m_ScalarOpacityFunction->AddPoint(139.524336,0.000000);
+ m_ScalarOpacityFunction->AddPoint(274.458333,0.228650);
+ m_ScalarOpacityFunction->AddPoint(638.420139,0.721763);
+
+
+ // gradient at grayvalue->opacity
+ m_GradientOpacityFunction->AddPoint(560.695000,1.000000);
+
+ // grayvalue->color
+ m_ColorTransferFunction->AddRGBPoint( 85.382743,0.478431,0.000000,0.000000);
+ m_ColorTransferFunction->AddRGBPoint( 198.201327,0.933333,0.000000,0.000000);
+ m_ColorTransferFunction->AddRGBPoint( 254.610619,1.000000,0.800000,0.062745);
+ m_ColorTransferFunction->AddRGBPoint( 336.0907085,1.000000,0.905882,0.666667);
+ m_ColorTransferFunction->AddRGBPoint( 630.672566,1.000000,1.000000,1.000000);
+}
+
+void TransferFunctionModeCreator::SetCtThoraxSmallMode()
+{
+ // grayvalue->opacity
+ m_ScalarOpacityFunction->AddPoint(147.216912,0.000000);
+ m_ScalarOpacityFunction->AddPoint(274.458333,0.228650);
+ m_ScalarOpacityFunction->AddPoint(430.330882,0.675532);
+
+
+ // gradient at grayvalue->opacity
+ m_GradientOpacityFunction->AddPoint(560.695000,1.000000);
+
+
+ // grayvalue->color
+ m_ColorTransferFunction->AddRGBPoint( 129.607774,0.478431,0.000000,0.000000);
+ m_ColorTransferFunction->AddRGBPoint( 213.812721,0.933333,0.000000,0.000000);
+ m_ColorTransferFunction->AddRGBPoint( 348.540636,1.000000,0.800000,0.062745);
+ m_ColorTransferFunction->AddRGBPoint( 500.419118,1.000000,0.898039,0.776471);
+ m_ColorTransferFunction->AddRGBPoint( 579.268382,1.000000,1.000000,1.000000);
+}
+
+void TransferFunctionModeCreator::SetCtBoneMode()
+{
+ // grayvalue->opacity
+ m_ScalarOpacityFunction->AddPoint(126.413793,0.000000);
+ m_ScalarOpacityFunction->AddPoint(178.312160,0.014663);
+ m_ScalarOpacityFunction->AddPoint(247.509982,0.000000);
+ m_ScalarOpacityFunction->AddPoint(1013.010889,1.000000);
+
+ // gradient at grayvalue->opacity
+ m_GradientOpacityFunction->AddPoint(485.377495,1.000000);
+
+ // grayvalue->color
+ m_ColorTransferFunction->AddRGBPoint( 312.382940,1.000000,0.564706,0.274510);
+ m_ColorTransferFunction->AddRGBPoint( 455.103448,1.000000,0.945098,0.768627);
+ m_ColorTransferFunction->AddRGBPoint( 623.773140,1.000000,0.800000,0.333333);
+ m_ColorTransferFunction->AddRGBPoint( 796.767695,1.000000,0.901961,0.815686);
+ m_ColorTransferFunction->AddRGBPoint( 930.838475,1.000000,1.000000,1.000000);
+ m_ColorTransferFunction->AddRGBPoint(1073.558984,1.000000,0.839216,0.423529);
+ m_ColorTransferFunction->AddRGBPoint(1220.604356,1.000000,0.772549,0.490196);
+
+}
+
+void TransferFunctionModeCreator::SetCtBoneGradientMode()
+{
+ // grayvalue->opacity
+ m_ScalarOpacityFunction->AddPoint(126.413793,0.000000);
+ m_ScalarOpacityFunction->AddPoint(186.961887,0.146628);
+ m_ScalarOpacityFunction->AddPoint(247.509982,0.000000);
+ m_ScalarOpacityFunction->AddPoint(1013.010889,1.000000);
+
+ // gradient at grayvalue->opacity
+ m_GradientOpacityFunction->AddPoint(22.617060,0.000000);
+ m_GradientOpacityFunction->AddPoint(65.865699,1.000000);
+
+ // grayvalue->color
+ m_ColorTransferFunction->AddRGBPoint( 312.382940,1.000000,0.564706,0.274510);
+ m_ColorTransferFunction->AddRGBPoint( 455.103448,1.000000,0.945098,0.768627);
+ m_ColorTransferFunction->AddRGBPoint( 623.773140,1.000000,0.800000,0.333333);
+ m_ColorTransferFunction->AddRGBPoint( 796.767695,1.000000,0.901961,0.815686);
+ m_ColorTransferFunction->AddRGBPoint( 930.838475,1.000000,1.000000,1.000000);
+ m_ColorTransferFunction->AddRGBPoint(1073.558984,1.000000,0.839216,0.423529);
+ m_ColorTransferFunction->AddRGBPoint(1220.604356,1.000000,0.772549,0.490196);
+}
+
+void TransferFunctionModeCreator::SetCtCardiacMode()
+{
+ //Set Opacity
+ m_ScalarOpacityFunction->AddPoint( 150.246824, 0.000000 );
+ m_ScalarOpacityFunction->AddPoint( 179.974592, 0.202346);
+ m_ScalarOpacityFunction->AddPoint( 276.589837, 0.000000);
+ m_ScalarOpacityFunction->AddPoint( 781.961887, 1.000000);
+
+ //Set Color
+ m_ColorTransferFunction->AddRGBPoint( 395.500907,1.000000,0.000000,0.000000);
+ m_ColorTransferFunction->AddRGBPoint( 410.364791,1.000000,0.749020,0.000000);
+ m_ColorTransferFunction->AddRGBPoint( 484.684211,1.000000,0.878431,0.662745);
+ m_ColorTransferFunction->AddRGBPoint( 588.731397,1.000000,0.784314,0.482353);
+
+ //Set Gradient
+ m_GradientOpacityFunction->AddPoint( 246.862069, 0.215827 );
+}
+
+void TransferFunctionModeCreator::SetMrGenericMode()
+{
+ //Set Opacity
+ m_ScalarOpacityFunction->AddPoint( 0, 0 );
+ m_ScalarOpacityFunction->AddPoint( 20, 0 );
+ m_ScalarOpacityFunction->AddPoint( 40, 0.15 );
+ m_ScalarOpacityFunction->AddPoint( 120, 0.3 );
+ m_ScalarOpacityFunction->AddPoint( 220, 0.375 );
+ m_ScalarOpacityFunction->AddPoint( 1024, 0.5);
+
+ //Set Color
+ m_ColorTransferFunction->AddRGBPoint( 0, 0, 0, 0 );
+ m_ColorTransferFunction->AddRGBPoint( 20, 0.168627, 0, 0 );
+ m_ColorTransferFunction->AddRGBPoint( 40, 0.403922, 0.145098, 0.0784314 );
+ m_ColorTransferFunction->AddRGBPoint( 120, 0.780392, 0.607843, 0.380392 );
+ m_ColorTransferFunction->AddRGBPoint( 220, 0.847059, 0.835294, 0.788235 );
+ m_ColorTransferFunction->AddRGBPoint( 1024, 1, 1, 1 );
+
+ //Set Gradient
+ m_GradientOpacityFunction->AddPoint( 0, 1 );
+ m_GradientOpacityFunction->AddPoint( 255, 1);
+}
+} // namespace
Index: mitkTransferFunctionModeCreator.h
===================================================================
--- mitkTransferFunctionModeCreator.h (revision 0)
+++ mitkTransferFunctionModeCreator.h (revision 0)
@@ -0,0 +1,104 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2010-05-10 18:06:04 +0200 (Mo, 10 Mai 2010) $
+Version: $Revision: 22790 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef MITK_TRANSFER_FUNCTION_MODE_CREATOR_H_HEADER_INCLUDED
+#define MITK_TRANSFER_FUNCTION_MODE_CREATOR_H_HEADER_INCLUDED
+
+#include <vtkPiecewiseFunction.h>
+#include <vtkColorTransferFunction.h>
+#include <vtkSmartPointer.h>
+
+#include <itkObject.h>
+#include <itkObjectFactory.h>
+
+#include "mitkCommon.h"
+
+namespace mitk {
+
+/**
+ * \brief Wrapper class for VTK scalar opacity, gradient opacity, and color
+ * transfer functions.
+ *
+ * Holds a copy of each of the three standard VTK transfer functions (scalar
+ * opacity, gradient opacity, color) and provides an interface for manipulating
+ * their control points. Each original function can be retrieved by a Get()
+ * method.
+ *
+ * NOTE: Currently, transfer function initialization based on histograms or
+ * computed-tomography-presets is also provided by this class, but will likely
+ * be separated into a specific initializer class.
+ */
+ class MITK_CORE_EXPORT TransferFunctionModeCreator : public itk::Object
+{
+public:
+
+ mitkClassMacro(TransferFunctionModeCreator, itk::Object);
+
+ mitkNewMacro4Param(Self, int,
+ vtkPiecewiseFunction*,
+ vtkColorTransferFunction*,
+ vtkPiecewiseFunction*);
+
+ void SetMode(int mode);
+ void SetScalarOpacityFunction( vtkPiecewiseFunction* scalarOpacityFunction);
+ void SetColorTransferFunction( vtkColorTransferFunction* colorTransferFunction);
+ void SetGradientOpacityFunction(vtkPiecewiseFunction* gradientOpacityFunction);
+
+ void InitTransferFunctionMode();
+
+protected:
+ TransferFunctionModeCreator(int mode = 0,
+ vtkPiecewiseFunction* scalarOpacityFunction = NULL,
+ vtkColorTransferFunction* colorTransferFunction = NULL,
+ vtkPiecewiseFunction* gradientOpacityFunction = NULL);
+ virtual ~TransferFunctionModeCreator();
+
+private:
+ int m_Mode;
+ //Define Transfer Function
+ enum TransferFunctionMode{
+ TF_CT_DEFAULT,
+ TF_CT_BLACK_WHITE,
+ TF_CT_THORAX_LARGE,
+ TF_CT_THORAX_SMALL,
+ TF_CT_BONE,
+ TF_CT_BONE_GRADIENT,
+ TF_CT_CARDIAC,
+ TF_MR_GENERIC
+ };
+
+ vtkSmartPointer<vtkPiecewiseFunction> m_ScalarOpacityFunction;
+ vtkSmartPointer<vtkColorTransferFunction> m_ColorTransferFunction;
+ vtkSmartPointer<vtkPiecewiseFunction> m_GradientOpacityFunction;
+
+ //remove all old points
+ void RemoveAllPoints();
+ void SetModified();
+ void SetCtDefaultMode();
+ void SetCtBlackWhiteMode();
+ void SetCtThoraxLargeMode();
+ void SetCtThoraxSmallMode();
+ void SetCtBoneMode();
+ void SetCtBoneGradientMode();
+ void SetCtCardiacMode();
+ void SetMrGenericMode();
+
+};
+
+}
+
+#endif /* MITK_TRANSFER_FUNCTION_MODE_CREATOR_H_HEADER_INCLUDED */

File Metadata

Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
251
Default Alt Text
TransferFunctionChanges.patch (23 KB)

Event Timeline

Changes of the Transfer Function class