[vtkusers] Re: Re: small error using vtkImagePlaneWidget?

dean.inglis at camris.ca dean.inglis at camris.ca
Sun Apr 15 20:30:41 EDT 2007


Hi Mark,

the vtkImageReslice member of the widget is completely 
valid, the pipeline mechanism is not, unless
you mandate in a callback or other mechanism
to enforce validity.  You could do this for
example:
maintain a vtkImageData object that is 
instantiated in memory:
my_imageData = vtkImageData::New();
and then do 
my_imageData->DeepCopy(widget->GetResliceOutput()):
but this might be slow and use up memory
for large (depends on your system configuration
and hardware) data sets.  What you have been
doing is using pointers to objects which is
unsafe in the long term, since pointer addresses
can change depending on upstream activity, but
safe for temporary access.  So, the difference
is that a widget takes, let's say, a snapshot
of the data whereas a pipeline fully integrates
its time (update/modified) history and member access using the observer paradigm.

Dean

> CC: vtkusers at public.kitware.com
> Subject: Re: small error using vtkImagePlaneWidget?
> 
> Hi Dean,
> 
> I'm a bit worried now - I shouldn't be using the reslice member of the
> widget? I thought it is completely valid - all that's happening is the
> reslice member has its reslice cosines set to the orientation of the
> plane widget itself - this is how it is used in the VTK example I
> think.
> 
> If I make my own reslice, won't I just be doing the same exact thing -
> on the interaction callback set the reslice cosines from the plane
> widget orientation etc and just get the output? What will the
> difference be?
> 
> Thanks for your help,
> Mark
> 
> 
> On 4/15/07, dean.inglis at camris.ca <dean.inglis at camris.ca> wrote:
> > Mark,
> >
> > this is because the widget does not
> > make the input image data as part of a
> > regular pipeline. The widget is NOT a filter,
> > just a widget for viewing and manipulating
> > the view of it.  If you really want to reslice the
> > data, use a separate vtkImageReslice and pipeline.
> > This has been done with most vtk widgets: they
> > are just observers.  So, this brings up an
> > important design issue with widgets: should we
> > allow access to the inner widget "pipeline"
> > and if so, then widgets should maintain
> > proper pipeline input connections etc. otherwise,
> > there should be no API access to intermediate
> > data.
> >
> > Dean
> >
> > > Subject: small error using vtkImagePlaneWidget?
> > >
> > > Hi,
> > >
> > > I've set up a pipeline between vtkImagePlaneWidget and vtkImageData.
> > > It looks like this:
> > >
> > >     vtkImageData* pImgData = pPlaneWidget->GetResliceOutput();
> > >     pImgData->Update();
> > >     pImageViewer2->SetInput(pImageData);
> > >
> > > This works it most cases. I can spin the plane widget using the mouse
> > > as is setup by default. When I spin the plane close to 90 degrees, I
> > > get a VTK error as soon as Update() is called on pImgData:
> > >
> > >     ERROR: In .\vtkStreamingDemandDrivenPipeline.cxx, line 667
> > > vtkStreamingDemandDrivenPipeline (05306378): The update extent
> > > specified in the information for output port 0 on algorithm
> > > vtkImageReslice(052DB2A8) is 0 511 0 63 0 0, which is outside the
> > > whole extent 0 255 0 63 0 0.
> > >
> > > I don't understand how the extents are not matching when the plane is
> > > spun at this certain angle - I'm not modifying anything, just letting
> > > the pipeline do the work. Any idea as to what I've done wrong here?
> > >
> > > Thanks,
> > > Mark
> > >
> >
> 



More information about the vtkusers mailing list