<DIV id=RTEContent>  <DIV id=RTEContent>hello everyone, </DIV>  <DIV>&nbsp;</DIV>  <DIV><STRONG>Here is a brief guide on creating an image fro scratch in memory in VTK.</STRONG></DIV>  <DIV>&nbsp;</DIV>  <DIV>It wasnt obvious to me at the first look, but finally it dint take much time to figure it out....</DIV>  <DIV>&nbsp;</DIV>  <DIV>I am sure there would be many other ways to do this.............But here is the way i did it......... </DIV>  <DIV>&nbsp;</DIV>  <DIV>If anyone knows any alternative ways, please to add them to this thread. I know you could also do it with vtkImageCache and vtkStrcuturePoints.</DIV>  <DIV>&nbsp;</DIV>  <DIV>Here is how i solved the problem:</DIV>  <DIV>&nbsp;</DIV>  <DIV>vtkImageData is the basic data representation form for images in VTK.</DIV>  <DIV>&nbsp;</DIV>  <DIV>So if you want to create an image from scratch, you create an object of the vtkImageData.</DIV>  <DIV>&nbsp;</DIV>  <DIV>Set the image parameters first as shown in the code below. For
 example, If you want an RGB image set the number of scalar components to be 3.</DIV>  <DIV>&nbsp;</DIV>  <DIV>Then call allocate scalars which allocates the scalars of the PointData of vtkImageData is&nbsp;also derived from vtkDataSet it inherits the basic structure of a VTK data set.&nbsp;</DIV>  <DIV>&nbsp;</DIV>  <DIV>Then you set the scalar&nbsp;values as needed.</DIV>  <DIV>&nbsp;</DIV>  <DIV>Below is a small snippet of code that does it.&nbsp;</DIV>  <DIV>&nbsp;</DIV>  <DIV>**************************************************************************************************</DIV><FONT size=2>  <div>&nbsp;</div>  <div>vtkImageData *pZImage = vtkImageData::New();</div>  <div>pZImage-&gt;SetExtent( 0 , wx , 0 , wy , 0 , 0 );</div>  <div>pZImage-&gt;SetOrigin( 0.0 , 0.0 , 0.0 );</div>  <div>pZImage-&gt;SetSpacing( 1.0 , 1.0 , 1.0 );</div>  <div>pZImage-&gt;SetScalarTypeToUnsignedChar();</div>  <div>pZImage-&gt;SetNumberOfScalarComponents( 1 );</div> 
 <div>pZImage-&gt;AllocateScalars();</div>  <div>&nbsp;</div>  <div></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2>( </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> i = 0 ; i &lt; wx ; i++ )</div>  <div>{</div>  <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">  <div></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2>( </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> j = 0 ; j &lt; wy ; j++ )</div>  <div>{</div>  <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">  <div></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> index = i * j;</FONT></div>  <div><FONT size=2></FONT>&nbsp;</div>  <div><FONT size=2>// get scalar pointer to current pixel</div>  <div></FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2> *zPtr = (</FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2> *) pZImage-&gt;GetScalarPointer( i , j , 0
 );</FONT></div>  <div><FONT size=2></FONT>&nbsp;</div>  <div><FONT size=2>// set scalar value accordingly</div>  <div>*zPtr = 128;&nbsp; </div>  <div>&nbsp;</div></BLOCKQUOTE>  <div dir=ltr>}&nbsp;</div></BLOCKQUOTE>  <div>}</div>  <DIV></FONT>&nbsp;</DIV>  <DIV>*************************************************************************************************</DIV>  <DIV>&nbsp;</DIV>  <DIV>Regards,</DIV>  <DIV>&nbsp;</DIV>  <DIV>Deepak Roy<BR></DIV></DIV><p>
        
                <hr size=1>Yahoo! Shopping<br> 
Find Great Deals on Holiday Gifts at <a href="http://us.rd.yahoo.com/mail_us/footer/shopping/*http://shopping.yahoo.com/;_ylc=X3oDMTE2bzVzaHJtBF9TAzk1OTQ5NjM2BHNlYwNtYWlsdGFnBHNsawNob2xpZGF5LTA1 
">Yahoo! Shopping</a>