Browse Source

Fix the computed range of ctkVTKVolumePropertyWidget

Range can be outside of [0, 1]
Julien Finet 13 years ago
parent
commit
813df51c3a
1 changed files with 5 additions and 3 deletions
  1. 5 3
      Libs/Visualization/VTK/Widgets/ctkVTKVolumePropertyWidget.cpp

+ 5 - 3
Libs/Visualization/VTK/Widgets/ctkVTKVolumePropertyWidget.cpp

@@ -140,13 +140,15 @@ void ctkVTKVolumePropertyWidgetPrivate::setupUi(QWidget* widget)
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 void ctkVTKVolumePropertyWidgetPrivate::computeRange(double* range)
 void ctkVTKVolumePropertyWidgetPrivate::computeRange(double* range)
 {
 {
-  range[0] = 0.;
-  range[1] = 1.;
-
   if (!this->VolumeProperty)
   if (!this->VolumeProperty)
     {
     {
+    range[0] = 0.;
+    range[1] = 1.;
     return;
     return;
     }
     }
+  range[0] = VTK_DOUBLE_MAX;
+  range[1] = VTK_DOUBLE_MIN;
+
   Q_ASSERT(this->VolumeProperty->GetRGBTransferFunction(this->CurrentComponent));
   Q_ASSERT(this->VolumeProperty->GetRGBTransferFunction(this->CurrentComponent));
   Q_ASSERT(this->VolumeProperty->GetScalarOpacity(this->CurrentComponent));
   Q_ASSERT(this->VolumeProperty->GetScalarOpacity(this->CurrentComponent));
   Q_ASSERT(this->VolumeProperty->GetGradientOpacity(this->CurrentComponent));
   Q_ASSERT(this->VolumeProperty->GetGradientOpacity(this->CurrentComponent));