[vtkusers] test if vtkImageData is blank

Jonathan Morra jonmorra at gmail.com
Sun Dec 26 16:34:47 EST 2010


Great, that works perfectly, thanks.

On Sun, Dec 26, 2010 at 11:36 AM, David Gobbi <david.gobbi at gmail.com> wrote:

> Hi Jonathan,
>
> You have to go one level deeper with the Modified() call.
> Here is the recipe, both modified calls are necessary:
>
> image.Modified()
> image.GetPointData().GetScalars().Modified()
> range = image.GetScalarRange()
>
> This is because both vtkImageData and vtkDataArray have
> their own timestamps.
>
>  - David
>
>
>
> On Sun, Dec 26, 2010 at 12:08 PM, Jonathan Morra <jonmorra at gmail.com>
> wrote:
> > I tried this, and after invoking Modified() on the image data, the scalar
> > range is still [0, 0].
> >
> > On Sun, Dec 26, 2010 at 10:15 AM, Karthik Krishnan
> > <karthik.krishnan at kitware.com> wrote:
> >>
> >> GetScalarRange will re-compute the scalar range only if the image has
> been
> >> modified. It has time stamps internally to avoid re-computing the scalar
> >> range during every call to GetScalarRange().
> >>
> >> The method SetScalarComponentFromDouble does not change the MTime of the
> >> image for efficiency.
> >>
> >> Invoke Modified() on the image and then invoke GetScalarRange() and you
> >> should see it update.
> >>
> >>
> >> --
> >> karthik
> >>
> >>
> >>
> >> On Sun, Dec 26, 2010 at 11:19 PM, Sebastien Jourdain
> >> <sebastien.jourdain at kitware.com> wrote:
> >>>
> >>> I have no idea on the expected behavior... And I'm not much familiar
> >>> with imageData...
> >>>
> >>> Sorry,
> >>>
> >>> Seb
> >>>
> >>> On Sun, Dec 26, 2010 at 6:27 PM, Jonathan Morra <jonmorra at gmail.com>
> >>> wrote:
> >>> > This would appear to work, but after
> >>> > calling .SetScalarComponentFromDouble(x, y, z, 0, 1) the
> >>> > image.GetScalarRange() still returns [0, 0] which, I would assume, it
> >>> > shouldn't.  Am I doing something wrong?
> >>> >
> >>> > On Sun, Dec 26, 2010 at 8:47 AM, Sebastien Jourdain
> >>> > <sebastien.jourdain at kitware.com> wrote:
> >>> >>
> >>> >> If you have a scalar range on the data array and if the min/max are
> >>> >> equal to 0, you are done...
> >>> >>
> >>> >> Seb
> >>> >>
> >>> >> On Mon, Dec 20, 2010 at 6:15 PM, Jonathan Morra <jonmorra at gmail.com
> >
> >>> >> wrote:
> >>> >> > Is there a way to quickly tell if a vtkImageData is blank
> (contains
> >>> >> > all
> >>> >> > 0's)?  I can't iterate the pixels cause I'm in Java and that's too
> >>> >> > slow.
> >>> >> > _______________________________________________
> >>> >> > Powered by www.kitware.com
> >>> >> >
> >>> >> > Visit other Kitware open-source projects at
> >>> >> > http://www.kitware.com/opensource/opensource.html
> >>> >> >
> >>> >> > Please keep messages on-topic and check the VTK FAQ at:
> >>> >> > http://www.vtk.org/Wiki/VTK_FAQ
> >>> >> >
> >>> >> > Follow this link to subscribe/unsubscribe:
> >>> >> > http://www.vtk.org/mailman/listinfo/vtkusers
> >>> >> >
> >>> >> >
> >>> >
> >>> >
> >>> _______________________________________________
> >>> Powered by www.kitware.com
> >>>
> >>> Visit other Kitware open-source projects at
> >>> http://www.kitware.com/opensource/opensource.html
> >>>
> >>> Please keep messages on-topic and check the VTK FAQ at:
> >>> http://www.vtk.org/Wiki/VTK_FAQ
> >>>
> >>> Follow this link to subscribe/unsubscribe:
> >>> http://www.vtk.org/mailman/listinfo/vtkusers
> >>
> >
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101226/6676a994/attachment.htm>


More information about the vtkusers mailing list