[vtkusers] (no subject)

Qiang Wang wangq1979 at gmail.com
Tue Feb 5 10:43:22 EST 2013


Hi David,

Thank you for the valuable information.

My code is that loading raw data instead of a set of images from CSV file
to vtkImageData, and then renders the stacked images, for example, by means
of isosurface or volume. Below is a snapshot of the code:

vtkImageData* data = vtkImageData::New();
......
vtkDataArray* dataArray = ((vtkPointData
*)(data->GetPointData()))->GetScalars();

//open CSV file to load data
ifstream inputCsv(filePath);
if (inputCsv.fail())  {
    cout << "File not found" <<endl; return -2;
}

....

while(getline(inputCsv, line) && inputCsv.good() && index < numToRead) {
    // load raw data to ImageMatrix
....
for(int y = 0; y < 20; y++) {
for(int x = 0; x < 20; x++) {
....
dataArray->InsertNextTuple1(about);
}
}
....
}

data->SetDimensions(20,20,index);

// interpolate images
......

// rendering code
......

How should I use the vtkImageResize to interpolate the data stored in
vtkImageData?

Moreover, can I specify the interpolation algorithms when rendering the
stacked images?

Cheers,

Qiang



On 5 February 2013 14:59, David Gobbi <david.gobbi at gmail.com> wrote:
>
> On Tue, Feb 5, 2013 at 7:19 AM, Qiang Wang <wangq1979 at gmail.com> wrote:
> > Thanks for the prompt reply.
> >
> > The data is 20*20 well structured data, which can be treated as a square
> > image. I want to interpolate it to 100*100 square image.
>
> Use vtkImageResize, and call resize->SetOutputDimensions(100,100,1).
> Read the documentation for vtkImageResize::SetBorder() carefully, to see
> whether you want to use BorderOn() or BorderOff().  Default interpolation
> is Lanczos but you can use SetInterpolator() to choose other interpolation
> methods.  Currently, the available interpolators are
vtkImageSincInterpolator,
> vtkImageBSplineInterpolator, and vtkImageInterpolator for basic (i.e.
linear,
> cubic) interpolation.  All of these methods require VTK 5.10.  I also
have a
> Gaussian interpolator that will be included in VTK 6.
>
>  - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130205/fc1cfee5/attachment.htm>


More information about the vtkusers mailing list