<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Basically, instantiate a vtkImageData class. Set the data Type to the type that your "measured value" is, (int or float or char..). Set the extents (width, height, depth). Set the scaling factor (in case your data is not 0,1,2,3,4, but something like (0.5, 1.0, 1.5, ...)<div> Then loop on your measured values and set each pixel in the image data object:</div><div><br class="webkit-block-placeholder"></div><div>vtkImageData* image = vtkImageData::New();</div><div>image-&gt;setDimensions(width, height, depth);</div><div>image-&gt;SetScalarTypeToFloat(); // or what ever makes sense</div><div>image-&gt;SetSpacing ( ... );</div><div>image-&gt;SetOrigin (.... );</div><div>void* dataPointer = NULL;</div><div><br class="webkit-block-placeholder"></div><div>for (int i = ....)</div><div>  for (int j = .... )</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>dataPointer = image-&gt;getScalarPointer(i,j,0);<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>*dataPointer = [get the value for this pixel from your data];<br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>Something like the above should get you close.</div><div>Mike</div><div><br class="webkit-block-placeholder"></div><div><div><div>On Jan 22, 2008, at 10:14 AM, Oliver Kania wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hello and thanks,<br>We have points in the eucledian plane which are arranged like a regular grid.<br>(evenly spaced)<br>We have a measured value for each point that should be interpreted as a grey-scale or color<br>value. <br>How do I tie this to a vtkImageData ?<br><br>best regards,<br>Oliver<br><br>PS: we already ordered both VTK-books.<br><br><div><span class="gmail_quote">2008/1/22, burlen &lt;<a href="mailto:burlen@apollo.sr.unh.edu"> burlen@apollo.sr.unh.edu</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">   <div bgcolor="#ffffff" text="#000000"> Hi, Oliver, writing an image loader is fairly strait forward but the details depend on the specifics of your data. Does your data have a regular Cartesian geometry? You first need to figure out which vtkDataSet best matches the geometry of your data. For instance using an vtkUnstructuredGrid where you could use vtkImageData would overly complicate things and adversely impact performance. A good deal of information can be found in the vtk users guide. In ver 4.2 of the user guide chap 5 has relevant info. If you plan to use VTK you would be well advised to obtain a copy.<br> Burlen<br> <br> <br> <br> Oliver Kania wrote: <blockquote type="cite"><div><span class="e" id="q_117a1fafe7cfa595_1">  <div>Hello !<br> Can someone provide a step by step guide on<br> writing a custom image loader.<br> We basically have 2D-point data with values attached to each point. <br>  <div><br>  <br> Best regards, Oliver</div></div></span></div></blockquote></div></blockquote></div></blockquote><br></div><div><br class="webkit-block-placeholder"></div></div></body></html>