[vtkusers] vtkImageData point extraction
David Gobbi
david.gobbi at gmail.com
Tue Dec 28 02:45:54 EST 2010
Hi Kourosh,
Don't use SpatialMatchOn() until you first have it working properly
with SpatialMatchOff(). Also, don't forget to do probe->Update()
before you use the probe filter's output.
If sgrid->SetDimensions(dims) the only thing that you did to set up
the structured grid, then that isn't enough. The structured grid
needs you to set the points (I've never used vtkStructuredGrid,
myself, so I can't provide an example, but I'm sure that it takes a
few more steps to create the data).
David
On Sat, Dec 25, 2010 at 8:38 PM, Jafari, Kourosh <kjafari at rad.hfh.edu> wrote:
> Hi David,
>
> I have similar a question. I have a 3D image volume and would like to sample it on a structured grid. Here is how I use it:
>
> static int dims[3]={100,100,100};
> vtkStructuredGrid *sgrid = vtkStructuredGrid::New();
> sgrid->SetDimensions(dims);
>
> ....
>
> probe->SetInput(sgrid);
> probe->SetSource(connector->GetOutput());
> probe->SpatialMatchOn();
>
> vtkImageData *imageP = vtkImageData::New();
> imageP->DeepCopy(probe->GetImageDataOutput());
>
>
> The type of connector->GetOutput() is vtkImageData which is the volume I'd like to sample. I later display imageP. There is no compilation error but it crashes when I run it. If I exchange the inputs of SetInput and SetSource, it does not crash but it does not do anything either. What am I missing?
>
> Thanks!!
> Kourosh
>
>
> ________________________________________
> From: vtkusers-bounces at vtk.org [vtkusers-bounces at vtk.org] On Behalf Of David Gobbi [david.gobbi at gmail.com]
> Sent: Friday, December 24, 2010 4:51 PM
> To: Maxwell, Thomas P. (GSFC-606.2)[SCIENCE APPLICATIONS INTL CORP]
> Cc: vtkusers at vtk.org
> Subject: Re: [vtkusers] vtkImageData point extraction
>
> Hi Tom,
>
> I think you want vtkProbeFilter. It takes two inputs, one input for
> volumetric data and another input for a set of points whose scalars
> will be interpolated from the first input.
>
> probeFilter->SetSourceConnection(<data-to-be-interpolated goes here>)
> probeFilter->SetInputConnection(<point input goes here>)
>
> Is this what you were looking for?
>
> David
>
>
> On Thu, Dec 23, 2010 at 9:43 AM, Maxwell, Thomas P.
> (GSFC-606.2)[SCIENCE APPLICATIONS INTL CORP] <thomas.maxwell at nasa.gov>
> wrote:
>>
>> Is there a VTK filter that will take as input a vtkImageData and a list of
>> (unstructured) points and then compute (as output) the image values at the
>> specified point locations?
>>
>> Thanks,
>> Tom
> _______________________________________________
> 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
More information about the vtkusers
mailing list