<HTML>
<HEAD>
<TITLE>Re: [Paraview] Question about writing custom reader for paraview</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>What you are using is not quite right. &nbsp;First, it sounds like you really want to create a vtkImageData. &nbsp;This data holds a 1D, 2D, or 3D grid of points with origin and uniform spacing on each axis. &nbsp;Thus, you would inherit from vtkImageAlgorithm and cast your output to vtkImageData.<BR>
<BR>
Second, the only thing you directly set in the output information is the WHOLE_EXTENT(). &nbsp;You do this in RequestInformation so that the downstream pipeline can make decisions about what to load before the data is actually loaded. &nbsp;So, the first line you have below is correct, assuming you put it in RequestInformation.<BR>
<BR>
Now, you don&#8217;t set UPDATE_EXTENT, you get it. &nbsp;Someone downstream will set this the region of data in which it wants you to load. &nbsp;You don&#8217;t actually have to get this directly from the output information; you can get it from the output object. &nbsp;So in RequestData, you would have code like this:<BR>
<BR>
</SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'> &nbsp;vtkImageData *output = vtkImageData::GetData(outInfo);<BR>
&nbsp;&nbsp;int *extent = output-&gt;GetUpdateExtent();<BR>
</SPAN></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
Now you can set the actual extent, spacing, origin, and data itself directly into the data object.<BR>
<BR>
</SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'> &nbsp;output-&gt;SetExtent(extent);<BR>
&nbsp;&nbsp;output-&gt;SetOrigin(origin);<BR>
&nbsp;&nbsp;output-&gt;SetSpacing(ar);<BR>
</SPAN></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
You can then set the data either by allocating and getting scalar data through the vtkImageData or by adding data to the image data&#8217;s point data structure (retrieved with GetPointData()). &nbsp;More details are in <I>The VTK User&#8217;s Guide</I>.<BR>
<BR>
-Ken<BR>
<BR>
<BR>
On 3/19/09 1:08 AM, &quot;shenyanwen&quot; &lt;<a href="shenyanwen@gmail.com">shenyanwen@gmail.com</a>&gt; wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
<BR>
<BR>
<BR>
Hi, I am writing a custom reader for paraview to read my own data file which paraview hasn't have.<BR>
I have known that the most important method is RequestInformation and RequestData, and I just want to write a reader that can output the data type of StructuredPoints with Scalar and some vectors.I have already use :<BR>
outInfo-&gt;Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),<BR>
                 0,dim[1]-1,0,dim[1]-1,0,dim[2]-1);<BR>
    outInfo-&gt;Set(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(),<BR>
                 0,dim[1]-1,0,dim[1]-1,0,dim[2]-1);<BR>
and:outInfo-&gt;Set(vtkDataObject::SPACING(), ar, 3);<BR>
outInfo-&gt;Set(vtkDataObject::ORIGIN(), origin, 3);<BR>
and how can I read the scalar data just like the file-format describes:<BR>
SCALAR dataName dataType numComp<BR>
LOOKUP_TABLE tableName<BR>
s0<BR>
s1<BR>
s2<BR>
...<BR>
s(n-1)<BR>
<BR>
which method or function can I use to read the s0,s1,...,s(n-1) into the variable and set to the outInfo.<BR>
Thanks so much!<BR>
<FONT COLOR="#888888"><BR>
</FONT><BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'><BR>
&nbsp;&nbsp;&nbsp;**** &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Kenneth Moreland<BR>
&nbsp;&nbsp;&nbsp;&nbsp;*** &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sandia National Laboratories<BR>
*********** &nbsp;<BR>
*** *** *** &nbsp;email: <a href="kmorel@sandia.gov">kmorel@sandia.gov</a><BR>
** &nbsp;*** &nbsp;** &nbsp;phone: (505) 844-8919<BR>
&nbsp;&nbsp;&nbsp;&nbsp;*** &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;web: &nbsp;&nbsp;<a href="http://www.cs.unm.edu/~kmorel">http://www.cs.unm.edu/~kmorel</a><BR>
</SPAN></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT>
</BODY>
</HTML>