4 * \brief Class bbtk::ThresholdImageView .
7 #include "ThresholdImageView.h"
8 #include <vtkImageReslice.h>
9 #include <vtkLookupTable.h>
10 #include <vtkImageData.h>
13 //=========================================================================
14 //=========================================================================
15 //=========================================================================
16 //=========================================================================
17 ThresholdImageView::ThresholdImageView( )
26 //=========================================================================
27 ThresholdImageView::~ThresholdImageView()
30 //=========================================================================
34 //----------------------------------------------------------------------------
35 void ThresholdImageView::SetminMaxValue(int min, int max)
42 //----------------------------------------------------------------------------
43 void ThresholdImageView::ConfigLookupTable() // virtual
47 GetImage()->GetScalarRange(range);
53 int minTot = floor (range[0]);
54 int maxTot = ceil (range[1]);
56 int minVal = floor (_minValue);
57 int maxVal = floor (_maxValue);
59 vtkLookupTable* thresholdTable = GetThresholdTable();
60 thresholdTable->SetNumberOfTableValues(maxTot+1);
61 thresholdTable->SetTableRange(range);
62 thresholdTable->SetAlphaRange(0, 1);
63 thresholdTable->SetValueRange(0, 1);
64 thresholdTable->SetSaturationRange(0, 0);
65 thresholdTable->SetRampToLinear( );
67 //Assign a fake color for the upper image, and set the white as transparent
69 for(i = minTot; i <= maxTot; i++)
71 if( i >= minVal && i <= maxVal )
73 thresholdTable->SetTableValue(i,_baseColorR,_baseColorG,_baseColorB, 1);
75 else if( i >= minTot && i < minVal )
77 thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
79 else if( i > maxVal && i < maxTot )
81 thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
85 thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
88 thresholdTable->Build( );
93 //----------------------------------------------------------------------------
94 void ThresholdImageView::SetBaseColor(double r, double g, double b)