<DIV>Hi David,</DIV>
<DIV>&nbsp;</DIV>
<DIV>do you speak french ??</DIV>
<DIV>i don't see how the data can be copied&nbsp; like this&nbsp; with this code;</DIV>
<DIV>&nbsp;</DIV>
<DIV>-------------&nbsp;&nbsp; data of image 0 </DIV>
<DIV>-------------&nbsp;&nbsp; data of image 1</DIV>
<DIV>-------------&nbsp;&nbsp; data of image 2</DIV>
<DIV>-------------&nbsp;&nbsp; data image 3</DIV>
<DIV>-------------&nbsp;&nbsp;&nbsp;&nbsp; ....</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>///////////////************the code *****************/////////////////////////////</DIV>
<DIV>&nbsp;</DIV>
<DIV>void TimacBase::constructImagedata(CImageBoxFL *img_box,int nbr_slices,inter_slices)<BR>{</DIV>
<DIV>&nbsp;int width;<BR>&nbsp;int height;</DIV>
<DIV>&nbsp;width = img_box-&gt;tab[0].imgAff-&gt;largeur;<BR>&nbsp;height = img_box-&gt;tab[0].imgAff-&gt;hauteur;</DIV>
<DIV>&nbsp; imageData-&gt;SetScalarTypeToUnsignedChar();<BR>&nbsp; imageData-&gt;SetNumberOfScalarComponents(3);<BR>&nbsp; imageData-&gt;SetDimensions(width,height, nbr_slices);<BR>&nbsp; imageData-&gt;AllocateScalars();</DIV>
<DIV>&nbsp;&nbsp;</DIV>
<DIV>&nbsp;&nbsp;unsigned char *data = (unsigned char *) imageData-&gt;GetScalarPointer();</DIV>
<DIV>&nbsp; int k = 0;<BR>&nbsp; for (k= 0; k&lt;nbr_slices; k+=inter_slices) <BR>&nbsp; {<BR>&nbsp; memcpy(data, img_box-&gt;tab[k].imgAff-&gt;data, nbr_slices*3*sizeof(unsigned char));&nbsp;&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; data += width * height *3*sizeof(unsigned char);</DIV>
<DIV>&nbsp; }<BR>} </DIV>
<DIV>&nbsp;</DIV>
<DIV>///////////////////*******************************************************************</DIV>
<DIV><BR>thanks ,</DIV>
<DIV>*dali<BR></DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR><BR>David Cole wrote: 
<BLOCKQUOTE cite=mid42A98C1E.5060609@kitware.com type="cite">Nope. (And again, please keep further questions on the list.)<BR><BR>When you call AllocateScalars you are allocating a chunk of memory that is for the raw image data of type unsigned char with 3 components for each voxel with 16x16x16 voxels. So you're allocating 16x16x16x3xsizeof(unsigned char) bytes which is expected to be used for the data. You need to copy your raw data into that block of memory to use the technique I've outlined.<BR><BR>You need something more like this:<BR>&nbsp; for (k= 0; k&lt;16; ++k) <BR>&nbsp; {<BR>&nbsp; memcpy(data, img_box-&gt;tab[k].imgAff-&gt;data, 16*3*sizeof(unsigned char));&nbsp; // tab is an array og images <BR>&nbsp; data += 16*16*3*sizeof(unsigned char);<BR>&nbsp; }<BR><BR>If you want to use the memory you've already got allocated for a vtkImageData, you need to dig in and figure out how it works inside or have somebody else chime in to help you. I don't know if that's easily done -
 I'm still a relative newcomer to VTK myself.<BR><BR><BR>David<BR><BR><BR>med ali wrote: 
<BLOCKQUOTE cite=mid20050610104548.10781.qmail@web26401.mail.ukl.yahoo.com type="cite">
<DIV>hi,</DIV>
<DIV>&nbsp;</DIV>
<DIV>thanks for your help</DIV>
<DIV>&nbsp;</DIV>
<DIV>can you tell me if this part of code is right or not </DIV>
<DIV>&nbsp;i have wrote this&nbsp;:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>////////////////////**********************&nbsp; constructImageData***************/////////////////////////////</DIV>
<DIV>void TimacBase::constructImageData(CImageBoxFL *img_box)<BR>{</DIV>
<DIV>&nbsp; imageData-&gt;SetScalarTypeToUnsignedChar();<BR>&nbsp; imageData-&gt;SetNumberOfScalarComponents(3);<BR>&nbsp; imageData-&gt;SetDimensions(16, 16, 16);<BR>&nbsp; imageData-&gt;AllocateScalars();</DIV>
<DIV>&nbsp; int i = 0;<BR>&nbsp; int j = 0;<BR>&nbsp; unsigned char r = 0;<BR>&nbsp; unsigned char g = 0;<BR>&nbsp; unsigned char b = 0;<BR>&nbsp; unsigned char *data = (unsigned char *) imageData-&gt;GetScalarPointer();</DIV>
<DIV>&nbsp; int k = 0;<BR>&nbsp; for (k= 0; k&lt;16; ++k) <BR>&nbsp; {<BR>&nbsp; data=img_box-&gt;tab[k].imgAff-&gt;data;&nbsp; // tab is an array og images <BR>&nbsp; }<BR>} <BR><BR><B><I>David Cole <A class=moz-txt-link-rfc2396E href="mailto:david.cole@kitware.com">&lt;david.cole@kitware.com&gt;</A></I></B> a écrit :</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid">If you need a 3d volume of bitmaps that are all the same x,y size, just do the same thing, but add an iteration over the z-dimension. The vtkImageData object supports 3 dimensions. Then, for each distinct value of z, you'll be jamming a separate bitmap into a given z-slice of the vtkImageData.<BR><BR>In the example, change the SetDimensions call to include more than one z value:<BR>&nbsp; imageData-&gt;SetDimensions(16, 16, <B>16</B>);<BR><BR>Then add another loop to fill in the z data:<BR>&nbsp; int k = 0;<BR>&nbsp; for (k= 0; k&lt;16; ++k) // as outer loop; i and j loops in here; conecptually, first slice filled is z=0, next z=1 and so on...<BR><BR>Then simply use the imageData object as the input to your algorithm, just like you would have used the output of the BMP reader...<BR><BR><BR>David<BR><BR><BR>
<BLOCKQUOTE cite=mid20050609174215.91108.qmail@web26403.mail.ukl.yahoo.com type="cite">
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid">&nbsp;</BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<P></P>
<HR SIZE=1>
<B><FONT color=#ff0000>Appel audio GRATUIT</FONT> partout dans le monde</B> avec le nouveau Yahoo! Messenger<BR><A href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com">Téléchargez le ici !</A> </BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE><p>
                <hr size=1> 
<b><font color=#FF0000>Appel audio GRATUIT</font> partout dans le monde</b> avec le nouveau Yahoo! Messenger<br> 
<a href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com">Téléchargez le ici !</a>