<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="IncrediMail 1.0" name=GENERATOR>
<STYLE>
v\:* {behavior:url (#default#vml);}
</STYLE>
<style>v\:* {
        BEHAVIOR: url (#default#vml)
}
</style>
<!--IncrdiXMLRemarkStart>
<IncrdiX-Info>
<X-FID>BA285063-5BCE-11D4-AF8D-0050DAC67E11</X-FID>
<X-FVER>2.0</X-FVER>
<X-FIT>Letter</X-FIT>
<X-FILE>Letter\rice_fields.imf</X-FILE>
<X-FCOL>Elegant Paper</X-FCOL>
<X-FCAT>Stationery</X-FCAT>
<X-FDIS>Rice Fields</X-FDIS>
<X-Extensions>SU1CTDEsNDEsgUmBSTAkkcGNgZmVTY0wNCxNhYUoiU0kOMEoTYGBjYEoJDSZnSyFhUksSU1CTDIsMCwsSU1CTDMsMCws</X-Extensions>
<X-BG>cid:522FD074-A7DC-4BD1-8AE1-5FC0899198C4</X-BG>
<X-BGT>repeat</X-BGT>
<X-BGC>#eff3f7</X-BGC>
<X-BGPX>left</X-BGPX>
<X-BGPY>top</X-BGPY>
<X-ASN>ANIM3D00-NONE-0000-0000-000000000000</X-ASN>
<X-ASNF>0</X-ASNF>
<X-ASH>ANIM3D00-NONE-0000-0000-000000000000</X-ASH>
<X-ASHF>1</X-ASHF>
<X-AN>6486DDE0-3EFD-11D4-BA3D-0050DAC68030</X-AN>
<X-ANF>0</X-ANF>
<X-AP>6486DDE0-3EFD-11D4-BA3D-0050DAC68030</X-AP>
<X-APF>1</X-APF>
<X-AD>C3C52140-4147-11D4-BA3D-0050DAC68030</X-AD>
<X-ADF>0</X-ADF>
<X-AUTO>X-ASN,X-ASH,X-AN,X-AP,X-AD</X-AUTO>
<X-CNT>;</X-CNT>
</IncrdiX-Info>
<IncrdiXMLRemarkEnd-->
</HEAD>
<BODY style="BACKGROUND-POSITION: left top; FONT-SIZE: 12pt; MARGIN: 0px 10px 10px; COLOR: #00005b; BACKGROUND-REPEAT: repeat; FONT-FAMILY: Arial" text=#00005b bgColor=#eff3f7 background=cid:522FD074-A7DC-4BD1-8AE1-5FC0899198C4 scroll=yes SIGCOLOR="0">
<TABLE id=INCREDIMAINTABLE cellSpacing=0 cellPadding=2 width="100%" border=0>
<TBODY>
<TR>
<TD id=INCREDITEXTREGION style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 12pt; PADDING-BOTTOM: 0px; PADDING-TOP: 0px" vAlign=top width="100%">
<DIV>&nbsp;</DIV>
<DIV>hi all,</DIV>
<DIV>iv tried this code but it's not working....</DIV>
<DIV>basically the image is not&nbsp;getting generated...only some jagged lines r displayed........</DIV>
<DIV><!--StartFragment -->plz help...</DIV>
<DIV>nitin&nbsp;</DIV>
<DIV><PRE>Hi Adrian,

Take a look at vtkImageImport, what you are trying to do can
be done as follows:

import = vtkImageImport::New();
import-&gt;SetDataExtent(0,511,0,511,0,0);
import-&gt;SetDataScalarType(VTK_UNSIGNED_SHORT);
import-&gt;SetImportVoidPointer(Array);
import-&gt;UpdateWholeExtent();

vtkImageData *outData = import-&gt;GetOutput();


The best thing about this is that you don't have to copy the
data, outData will actually use Array as its memory pointer.

 - David
     

--David Gobbi, MSc                    <A href="http://www.vtk.org/mailman/listinfo/vtkusers">dgobbi at irus.rri.on.ca</A>
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario

On Wed, 17 Nov 1999, Adrian Anner wrote:

&gt;<I> hello
</I>&gt;<I> 
</I>&gt;<I> I have the data from a Picture in an 2d-Array (dim 512,512). Now I want
</I>&gt;<I> write this data to vtkImageData.
</I>&gt;<I> 
</I>&gt;<I> I tried the following but it didn't work :
</I>&gt;<I> 
</I>&gt;<I>    vtkImageData *outData = vtkImageData::New();
</I>&gt;<I>       outData-&gt;SetWholeExtent (0, 511, 0, 511, 0, 0);
</I>&gt;<I>       outData-&gt;SetScalarType(VTK_UNSIGNED_SHORT);
</I>&gt;<I> 
</I>&gt;<I> unsigned short *ptr;
</I>&gt;<I> 
</I>&gt;<I>    for (int y = 0; y &lt;512;y++)
</I>&gt;<I>    {
</I>&gt;<I>       for (int x = 0; x &lt;512; x++)
</I>&gt;<I> 
</I>&gt;<I> 
</I>&gt;<I>           ptr = (unsigned short *)(outData-&gt;GetScalarPointer(x, y, 0));
</I>&gt;<I>           *ptr = (unsigned short)Array[x][y];
</I>&gt;<I>       }
</I>&gt;<I>    }
</I>&gt;<I> 
</I>&gt;<I> it crashs with the error :
</I>&gt;<I> 
</I>&gt;<I> GetScalarPointer:Pixel(1,0,0) not in memory. Current extend = (0,0,0,0,0,0)
</I>&gt;<I> 
</I>&gt;<I> I'm using a recent nightly release.
</I>&gt;<I> 
</I>&gt;<I> thanks,
</I>&gt;<I> 
</I>&gt;<I> Adrian
</I>&gt;<I> 
</I>&gt;<I> 
</I>&gt;<I> </I></PRE></DIV></TD></TR>
<TR>
<TD id=INCREDIFOOTER width="100%">
<TABLE cellSpacing=0 cellPadding=0 width="100%">
<TBODY>
<TR>
<TD width="100%"></TD>
<TD id=INCREDISOUND vAlign=bottom align=middle></TD>
<TD id=INCREDIANIM vAlign=bottom align=middle></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><SPAN id=IncrediStamp><A href="http://www.incredimail.com/index.asp?id=96845"><SPAN name="imgCache" border="0"><IMG alt="FREE emoticons for your email! click Here!" src="cid:CC00EF3B-D6A6-4F0A-8EE1-0CF79FB2FA34" border=0></SPAN></A></SPAN></BODY></HTML>