<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
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 &eacute;crit :</div>
  <blockquote class="replbq"
 style="border-left: 2px solid rgb(16, 16, 255); padding-left: 5px; margin-left: 5px;">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="border-left: 2px solid rgb(16, 16, 255); padding-left: 5px; margin-left: 5px;">&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&eacute;l&eacute;chargez
le ici !</a> </blockquote>
</body>
</html>