<div dir="ltr">Hi David,<br><br>Thank you for the valuable information.<br><br>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: <div>
<br><div><div><font color="#3d85c6">vtkImageData* data = vtkImageData::New();</font></div><div><font color="#3d85c6">......</font></div><div><font color="#3d85c6">vtkDataArray* dataArray = ((vtkPointData *)(data->GetPointData()))->GetScalars();</font></div>
<div><font color="#3d85c6"><br></font></div><div><font color="#3d85c6">//open CSV file to load data</font></div><div><font color="#3d85c6">ifstream inputCsv(filePath);</font></div><div><font color="#3d85c6">if (inputCsv.fail()) { </font></div>
<div><font color="#3d85c6"> cout << "File not found" <<endl; return -2; </font></div><div><font color="#3d85c6">}</font></div><div><font color="#3d85c6"><br></font></div><div><font color="#3d85c6">....</font></div>
<div><font color="#3d85c6"><br></font></div><div><font color="#3d85c6">while(getline(inputCsv, line) && inputCsv.good() && index < numToRead) {</font></div><div><font color="#3d85c6"> // load raw data to ImageMatrix</font></div>
<div><font color="#3d85c6"><span class="" style="white-space:pre">        </span>....</font></div><div><font color="#3d85c6"><span class="" style="white-space:pre">        </span>for(int y = 0; y < 20; y++) {</font></div><div><font color="#3d85c6"><span class="" style="white-space:pre">                </span>for(int x = 0; x < 20; x++) {</font></div>
<div><font color="#3d85c6"><span class="" style="white-space:pre">                        </span>....</font></div><div><font color="#3d85c6"><span class="" style="white-space:pre">                        </span>dataArray->InsertNextTuple1(about);</font></div><div>
<font color="#3d85c6"><span class="" style="white-space:pre">                </span>}</font></div><div><font color="#3d85c6"><span class="" style="white-space:pre">        </span>}</font></div><div><font color="#3d85c6"><span class="" style="white-space:pre">        </span>....</font></div>
<div><font color="#3d85c6">}</font></div><div><font color="#3d85c6"><br></font></div><div><font color="#3d85c6">data->SetDimensions(20,20,index);<br></font></div><div><font color="#3d85c6"><br></font></div><div style><font color="#3d85c6">// interpolate images</font></div>
<div style><font color="#3d85c6">......</font></div><div><font color="#3d85c6"><br></font></div><div style><font color="#3d85c6">// rendering code </font></div><div><font color="#3d85c6">......</font></div><div><br></div>
<div style>How should I use the vtkImageResize to interpolate the data stored in <font color="#000000">vtkImageData?</font></div><div style><font color="#000000"><br></font></div><div style><font color="#000000">Moreover, can I specify the interpolation algorithms when rendering the stacked images?</font></div>
<div style><font color="#000000"><br></font></div><div style><font color="#000000">Cheers,</font></div><div style><font color="#000000"><br></font></div><div style><font color="#000000">Qiang</font></div><div><br><br><br>
On 5 February 2013 14:59, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br>><br>> On Tue, Feb 5, 2013 at 7:19 AM, Qiang Wang <<a href="mailto:wangq1979@gmail.com">wangq1979@gmail.com</a>> wrote:<br>
> > Thanks for the prompt reply.<br>> ><br>> > The data is 20*20 well structured data, which can be treated as a square<br>> > image. I want to interpolate it to 100*100 square image.<br>><br>> Use vtkImageResize, and call resize->SetOutputDimensions(100,100,1).<br>
> Read the documentation for vtkImageResize::SetBorder() carefully, to see<br>> whether you want to use BorderOn() or BorderOff(). Default interpolation<br>> is Lanczos but you can use SetInterpolator() to choose other interpolation<br>
> methods. Currently, the available interpolators are vtkImageSincInterpolator,<br>> vtkImageBSplineInterpolator, and vtkImageInterpolator for basic (i.e. linear,<br>> cubic) interpolation. All of these methods require VTK 5.10. I also have a<br>
> Gaussian interpolator that will be included in VTK 6.<br>><br>> - David<br><br></div></div></div></div>