[vtk-developers] Bug in vtkImageMapToColors

David Gobbi david.gobbi at gmail.com
Mon May 9 13:50:17 EDT 2011


Hi Nicolas,

If you provide the new text that you would like to see in the documentation,
I can modify the file and commit the change.

 - David


On Mon, May 9, 2011 at 11:29 AM, Nicolas Rannou <
Nicolas_Rannou at hms.harvard.edu> wrote:

> Thanks David,
>
> yes such a feature to get the scalar range over all the components would be
> nice.
> Maybe we should also update the documentation (
> http://www.vtk.org/doc/nightly/html/classvtkDataSet.html#a9c8f06877f41b3e1944f2d10281083a6
> ).
>
>  virtual void vtkDataSet::GetScalarRange(double *range*[2])[virtual]
>
> Convenience method to get the range of the scalar data (if there is any
> scalar data). Returns the (min/max) range of combined point and cell data.
> If there are no point or cell scalars the method will return (0,1). Note:
> Update needs to be called to create the scalars. THIS METHOD IS THREAD SAFE
> IF FIRST CALLED FROM A SINGLE THREAD AND THE DATASET IS NOT MODIFIED
>
>
> To  highlight that it computes the scalar range on the first component?
>
> Thanks!
>
> Nicolas
>
> On May 7, 2011, at 5:25 PM, David Gobbi wrote:
>
> The only way that I know of is to get the range directly from the scalars,
>
> double range[2];
> data->GetPointData()->GetScalars()->GetRange(range, component);
>
> Personally, I would not be opposed to changing vtkDataSet::ComputeRange()
> so that it computed the range over all components.
>
>  David
>
>
> On Sat, May 7, 2011 at 1:37 PM, Nicolas Rannou
> <Nicolas_Rannou at hms.harvard.edu> wrote:
>
> Hi David,
>
>
> Thanks for the clarification.
>
> Which is the best practice to get the scalar range of each component then?
>
>
>
> On May 6, 2011, at 5:53 PM, David Gobbi wrote:
>
>
> Hi Nicolas,
>
>
> The GetScalarRange() method computes the scalar range of the first
> component.
>
>
> - David
>
>
>
> On Fri, May 6, 2011 at 3:00 PM, Nicolas Rannou
>
> <nicolas_rannou at hms.harvard.edu> wrote:
>
> Hello,
>
>
> I'm experiencing a strange behavior in VTK which might be a bug.
>
> It took me a while to locate the issue:
>
>
> if I create a LUT with a NULL red component:
>
>   iRed = 0;
>
>   iGreen = 255;
>
>   iBlue = 255;
>
>   iAlpha = 255;
>
>   double iRange[2] = {0, 255};
>
>
>   vtkSmartPointer<vtkLookupTable> lut =
>
>       vtkSmartPointer<vtkLookupTable>::New();
>
>   double* HSV = vtkMath::RGBToHSV(iRed,iGreen,iBlue);
>
>   lut->SetAlpha(iAlpha);
>
>   lut->SetHueRange(HSV[0], HSV[0]);
>
>   lut->SetSaturationRange(1, 1);
>
>   lut->SetValueRange(0, 1);
>
>   lut->SetRange(iRange);
>
>   lut->Build();
>
>
> I color my image with this LUT:
>
>
>   vtkSmartPointer<vtkImageMapToColors> coloredImage =
>
>       vtkSmartPointer<vtkImageMapToColors>::New();
>
>   coloredImage->SetLookupTable(iLUT);
>
>   coloredImage->SetInput( iImage );
>
>   coloredImage->PassAlphaToOutputOff();
>
>   coloredImage->SetOutputFormatToRGB();
>
>   coloredImage->Update();
>
>
> then:
>
>   double* range = coloredImage->GetOutput()->GetScalarRange();
>
> returns [0,0].
>
> then everything I do with this image is messed up...
>
>
> If iRed != 0, the scalar range of the "coloredImage" will be correct then
> my
>
> pipeline is working.
>
>
> Am I doing something wrong?
>
>
> Thanks,
>
>
> Nicolas
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110509/19c9ce48/attachment.html>


More information about the vtk-developers mailing list