//=========================================================================
ThresholdImageView::ThresholdImageView( )
{
- _actorPresent = false;
+ _actorPresent = false;
+ _Z = 0;
+ _minValue = 0;
+ _maxValue = 1000;
+ _image = NULL;
+ _imageReslicer = NULL;
+ _thresholdTable = NULL;
+ _thresholdMapper = NULL;
+ _thresholdActor = NULL;
+ _baseColorR = 1;
+ _baseColorG = 0;
+ _baseColorB = 0;
}
//=========================================================================
//----------------------------------------------------------------------------
void ThresholdImageView::SetImage(vtkImageData* image)
{
+ printf("ThresholdImageView::SetImage %p\n", image);
_image = image;
}
_baseView = baseview;
}
+//----------------------------------------------------------------------------
+wxVtkBaseView *ThresholdImageView::GetwxVtkBaseView()
+{
+ return _baseView;
+}
+
//----------------------------------------------------------------------------
void ThresholdImageView::SetZ(int z)
{
}
//----------------------------------------------------------------------------
-void ThresholdImageView::SetminMax(int min, int max)
+void ThresholdImageView::SetminMaxValue(int min, int max)
{
- _min = min;
- _max = max;
+ _minValue = min;
+ _maxValue = max;
}
//----------------------------------------------------------------------------
vtkImageData *img = _image;
img->GetScalarRange(range);
+ if (range[1]==0)
+ {
+ range[1]=255;
+ }
+
int minTot = floor (range[0]);
int maxTot = ceil (range[1]);
-//EED _pannew->onThresholdInstantChange(minMax);
- int minVal = floor (_min);
- int maxVal = floor (_max);
+ int minVal = floor (_minValue);
+ int maxVal = floor (_maxValue);
+
if (!_actorPresent)
{
{
_imageReslicer = vtkImageReslice::New();
_imageReslicer->SetInput( img );
- _imageReslicer->SetInformationInput(img);
+ _imageReslicer->SetInformationInput(img);
_imageReslicer->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
_imageReslicer->SetOutputDimensionality(2);
_imageReslicer->SetInterpolationModeToLinear();
{
if( i >= minVal && i <= maxVal )
{
- _thresholdTable->SetTableValue(i, 1.0, 0.0, 0.0, 1);
+ _thresholdTable->SetTableValue(i,_baseColorR,_baseColorG,_baseColorB, 1);
}
else if( i >= minTot && i < minVal )
{
{
if( i >= minVal && i <= maxVal )
{
- _thresholdTable->SetTableValue(i, 1.0, 0.0, 0.0, 1);
+ _thresholdTable->SetTableValue(i,_baseColorR,_baseColorG,_baseColorB, 1);
}
else if( i >= minTot && i < minVal )
{
_thresholdMapper->SetInput( img );
_thresholdActor->SetInput( _thresholdMapper->GetOutput() );
}
- /*
- vtkImageViewer2* viewer = vtkImageViewer2::New();
- viewer->SetInput( upperImageActor->GetInput() );
- viewer->SetColorLevel((range[1]-range[0])/2);
- viewer->SetColorWindow(range[1]);
- viewer->GetRenderer()->AddActor( upperImageActor );
- viewer->Render();
- */
-//EED _theViewPanel->RefreshInterface();
}
}
+//----------------------------------------------------------------------------
+void ThresholdImageView::SetBaseColor(double r, double g, double b)
+{
+ _baseColorR = r;
+ _baseColorG = g;
+ _baseColorB = b;
+}
// EOF