<DIV>hi David,</DIV>
<DIV>&nbsp;</DIV>
<DIV>thanks for this example </DIV>
<DIV>&nbsp;</DIV>
<DIV>this example work for one array but i want&nbsp; do that for many arrays of bmp images&nbsp; </DIV>
<DIV>because after&nbsp; i will pass the output to&nbsp; the <FONT size=2>vtkImageMarchingCubes .</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>how can i do this without using vtkBMPReader.</DIV>
<DIV>&nbsp;</DIV>
<DIV>regards </DIV>
<DIV>dali</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>
<P>&nbsp;</P>
<P>/////////////////////////////////////////////////////// the code&nbsp; ///////////////////////////////////////////</P>
<P><FONT color=#ff007f>vtkBMPReader *bmpreader=vtkBMPReader ::New();</FONT></P>
<P><FONT color=#ff007f>bmpreader-&gt;SetFilePrefix (prefix);</FONT></P>
<P><FONT color=#ff007f>bmpreader-&gt;SetFileNameSliceOffset(1);</FONT></P>
<P><FONT color=#ff007f>bmpreader-&gt;SetFilePattern("%s%d.bmp");</FONT></P>
<P><FONT color=#ff007f>bmpreader-&gt;SetDataExtent(0,width, 0,height, 0, 31); </FONT></P>
<P><FONT color=#ff007f>//319 -( width-1, 239 - (height-1), 10 - (no of bitmaps-1)</FONT></P>
<P><FONT color=#ff007f>bmpreader-&gt;SetDataSpacing(1,1,interslices);</FONT></P>
<P>&nbsp;</P>
<P>//marchingcubes</P>
<P>vtkImageMarchingCubes *MC=vtkImageMarchingCubes ::New();</P>
<P>MC-&gt;SetInput(bmpreader-&gt;GetOutput());</P>
<P>MC-&gt;SetValue(0,iso-value);</P>
<P>MC-&gt;GetOutput()-&gt;Update();</P>
<P>&nbsp;</P>
<P>////////////////////////////////&nbsp; ///////////////////////////////////////////////////////</P></FONT><BR><BR><B><I>David Cole &lt;david.cole@kitware.com&gt;</I></B> a écrit :</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Please keep questions/replies on the list in case somebody else has time to respond sooner. (Next time, keep cc'ing <A class=moz-txt-link-abbreviated href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A>...)<BR><BR>Here's a small example that builds a vtkImageData from raw r,g,b values and shows it in a render window. It's an adaptation and reduction of VTK/Examples/Tutorial/Step6/Cxx/Cone6.cxx. I've eliminated the cone source/mapper/actor and added a vtkImageData and vtkImageActor.<BR><BR>The important pieces of the puzzle are SetScalarTypeToUnsignedChar and SetNumberOfScalarComponents(3). Then you can fill in the r,g,b values to your liking in a loop after allocating the scalars. If you already have a bitmap allocated and filled in, there's probably a way for you to set that data in as the scalar data here as long as it is laid out properly: r, g, b sequentially for each pixel as
 shown here. I'll let somebody else who's done that before chime in if you need more help. :-)<BR><BR>//====================&lt;SampleCode&gt;====================<BR>#include "vtkImageActor.h"<BR>#include "vtkImageData.h"<BR>#include "vtkInteractorStyleTrackballCamera.h"<BR>#include "vtkRenderer.h"<BR>#include "vtkRenderWindow.h"<BR>#include "vtkRenderWindowInteractor.h"<BR><BR>int main()<BR>{<BR>&nbsp; vtkImageData *imageData = vtkImageData::New();<BR>&nbsp; imageData-&gt;SetScalarTypeToUnsignedChar();<BR>&nbsp; imageData-&gt;SetNumberOfScalarComponents(3);<BR>&nbsp; imageData-&gt;SetDimensions(16, 16, 1);<BR>&nbsp; imageData-&gt;AllocateScalars();<BR><BR>&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();<BR>&nbsp; for (i= 0; i&lt;16; ++i)<BR>&nbsp; for (j= 0; j&lt;16; ++j)<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp;
 //&nbsp;&nbsp;&nbsp; Checkerboard test pattern with red, green, blue and black quadrants:<BR>&nbsp;&nbsp;&nbsp; if ((j+i) % 2)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; r= g= b= 0;<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (i&gt;7 &amp;&amp; j&gt;7)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; r= 255;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (i&gt;7)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b= 255;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (j&gt;7)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g= 255;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp; White on the "other" part of the checkerboard:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; r= g= b=
 255;<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp; Grayscale ramp:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //r= g= b= 16*i + j;<BR>&nbsp;&nbsp;&nbsp; }<BR><BR>&nbsp;&nbsp;&nbsp; *data++ = r;<BR>&nbsp;&nbsp;&nbsp; *data++ = g;<BR>&nbsp;&nbsp;&nbsp; *data++ = b;<BR>&nbsp; }<BR><BR>&nbsp; vtkImageActor *imageActor = vtkImageActor::New();<BR>&nbsp; imageActor-&gt;SetInput(imageData);<BR>&nbsp; imageActor-&gt;InterpolateOff();<BR><BR>&nbsp; vtkRenderer *ren1= vtkRenderer::New();<BR>&nbsp; ren1-&gt;AddActor( imageActor );<BR>&nbsp; ren1-&gt;SetBackground( 0.1, 0.2, 0.4 );<BR><BR>&nbsp; vtkRenderWindow *renWin = vtkRenderWindow::New();<BR>&nbsp; renWin-&gt;AddRenderer( ren1 );<BR>&nbsp; renWin-&gt;SetSize( 300, 300 );<BR><BR>&nbsp; vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<BR>&nbsp; iren-&gt;SetRenderWindow(renWin);<BR><BR>&nbsp; vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New();<BR>&nbsp;
 iren-&gt;SetInteractorStyle(style);<BR><BR>&nbsp; iren-&gt;Initialize();<BR>&nbsp; iren-&gt;Start();<BR><BR>&nbsp; imageActor-&gt;Delete();<BR>&nbsp; imageData-&gt;Delete();<BR>&nbsp; ren1-&gt;Delete();<BR>&nbsp; renWin-&gt;Delete();<BR>&nbsp; iren-&gt;Delete();<BR>&nbsp; style-&gt;Delete();<BR><BR>&nbsp; return 0;<BR>}<BR>//====================&lt;/SampleCode&gt;====================<BR><BR><BR>Hope this helps you get a little further,<BR>David<BR><BR><BR><BR>med ali wrote: 
<BLOCKQUOTE cite=mid20050607153402.74432.qmail@web26407.mail.ukl.yahoo.com type="cite">
<DIV>Hi,</DIV>
<DIV>&nbsp;</DIV>
<DIV>thanks you,</DIV>
<DIV>but i 'am begginer in vtk </DIV>
<DIV>can you give me a short example that i can begin with .</DIV>
<DIV>&nbsp;</DIV>
<DIV>thanks,</DIV>
<DIV>&nbsp;</DIV>
<DIV>dali<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">The output of vtkBMPReader (which is derived from vtkImageAlgorithm) is a vtkImageData. Just construct a vtkImageData directly from your data with the correct dimensions, scalar type and underlying data rather than using vtkBMPReader.<BR><BR>med ali wrote: 
<BLOCKQUOTE cite=mid20050607144554.60708.qmail@web26407.mail.ukl.yahoo.com type="cite">
<DIV>
<P>Hi all,</P>
<P>&nbsp;</P>
<P>i want use vtkBMPReader&nbsp; but&nbsp; not directly on the files </P>
<P>&nbsp;instead of passing the prefix of slices&nbsp; can i pass the array data&nbsp; of pixels&nbsp; to vtkBMPReader</P><FONT size=2><FONT size=2>
<P>/* </P>
<P>bmp= vtkBMPReader::New();</P></FONT></FONT>
<P><FONT size=2>bmp-&gt;SetFilePrefix (prefix);</FONT></P>
<P><FONT size=2>bmp-&gt;SetFileNameSliceOffset(1);</FONT></P>
<P><FONT size=2>bmp-&gt;SetFilePattern("%s%d.bmp");</FONT></P>
<P><FONT size=2>*/</FONT></P></DIV>
<HR SIZE=1>
Découvrez le nouveau Yahoo! Mail : <FONT color=red>1 Go d'espace</FONT> de stockage pour vos mails, photos et vidéos !<BR><A href="http://us.rd.yahoo.com/mail_fr/mail_campaigns/splash/taglines_1go/default/*http://fr.promotions.yahoo.com/mail/creer28.html" target=_blank>Créez votre Yahoo! Mail</A> <PRE wrap=""><HR width="90%" SIZE=4>
_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: <A class=moz-txt-link-freetext href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</A>
Follow this link to subscribe/unsubscribe:
<A class=moz-txt-link-freetext href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</A>
  </PRE></BLOCKQUOTE></BLOCKQUOTE>
<P></P>
<HR SIZE=1>
Découvrez le nouveau Yahoo! Mail : <FONT color=red>1 Go d'espace</FONT> de stockage pour vos mails, photos et vidéos !<BR><A href="http://us.rd.yahoo.com/mail_fr/mail_campaigns/splash/taglines_1go/default/*http://fr.promotions.yahoo.com/mail/creer28.html" target=_blank>Créez votre Yahoo! Mail</A> </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>