<DIV>hi David,</DIV>
<DIV> </DIV>
<DIV>thanks for this example </DIV>
<DIV> </DIV>
<DIV>this example work for one array but i want do that for many arrays of bmp images </DIV>
<DIV>because after i will pass the output to the <FONT size=2>vtkImageMarchingCubes .</FONT></DIV>
<DIV> </DIV>
<DIV>how can i do this without using vtkBMPReader.</DIV>
<DIV> </DIV>
<DIV>regards </DIV>
<DIV>dali</DIV>
<DIV> </DIV>
<DIV><FONT size=2>
<P> </P>
<P>/////////////////////////////////////////////////////// the code ///////////////////////////////////////////</P>
<P><FONT color=#ff007f>vtkBMPReader *bmpreader=vtkBMPReader ::New();</FONT></P>
<P><FONT color=#ff007f>bmpreader->SetFilePrefix (prefix);</FONT></P>
<P><FONT color=#ff007f>bmpreader->SetFileNameSliceOffset(1);</FONT></P>
<P><FONT color=#ff007f>bmpreader->SetFilePattern("%s%d.bmp");</FONT></P>
<P><FONT color=#ff007f>bmpreader->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->SetDataSpacing(1,1,interslices);</FONT></P>
<P> </P>
<P>//marchingcubes</P>
<P>vtkImageMarchingCubes *MC=vtkImageMarchingCubes ::New();</P>
<P>MC->SetInput(bmpreader->GetOutput());</P>
<P>MC->SetValue(0,iso-value);</P>
<P>MC->GetOutput()->Update();</P>
<P> </P>
<P>//////////////////////////////// ///////////////////////////////////////////////////////</P></FONT><BR><BR><B><I>David Cole <david.cole@kitware.com></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>//====================<SampleCode>====================<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> vtkImageData *imageData = vtkImageData::New();<BR> imageData->SetScalarTypeToUnsignedChar();<BR> imageData->SetNumberOfScalarComponents(3);<BR> imageData->SetDimensions(16, 16, 1);<BR> imageData->AllocateScalars();<BR><BR> int i = 0;<BR> int j = 0;<BR> unsigned char r = 0;<BR> unsigned char g = 0;<BR> unsigned char b = 0;<BR> unsigned char *data = (unsigned char *) imageData->GetScalarPointer();<BR> for (i= 0; i<16; ++i)<BR> for (j= 0; j<16; ++j)<BR> {<BR>
// Checkerboard test pattern with red, green, blue and black quadrants:<BR> if ((j+i) % 2)<BR> {<BR> r= g= b= 0;<BR> <BR> if (i>7 && j>7)<BR> {<BR> r= 255;<BR> }<BR> else if (i>7)<BR> {<BR> b= 255;<BR> }<BR> else if (j>7)<BR> {<BR> g= 255;<BR> }<BR> }<BR> else<BR> {<BR> // White on the "other" part of the checkerboard:<BR> r= g= b=
255;<BR> <BR> // Grayscale ramp:<BR> //r= g= b= 16*i + j;<BR> }<BR><BR> *data++ = r;<BR> *data++ = g;<BR> *data++ = b;<BR> }<BR><BR> vtkImageActor *imageActor = vtkImageActor::New();<BR> imageActor->SetInput(imageData);<BR> imageActor->InterpolateOff();<BR><BR> vtkRenderer *ren1= vtkRenderer::New();<BR> ren1->AddActor( imageActor );<BR> ren1->SetBackground( 0.1, 0.2, 0.4 );<BR><BR> vtkRenderWindow *renWin = vtkRenderWindow::New();<BR> renWin->AddRenderer( ren1 );<BR> renWin->SetSize( 300, 300 );<BR><BR> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<BR> iren->SetRenderWindow(renWin);<BR><BR> vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New();<BR>
iren->SetInteractorStyle(style);<BR><BR> iren->Initialize();<BR> iren->Start();<BR><BR> imageActor->Delete();<BR> imageData->Delete();<BR> ren1->Delete();<BR> renWin->Delete();<BR> iren->Delete();<BR> style->Delete();<BR><BR> return 0;<BR>}<BR>//====================</SampleCode>====================<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> </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> </DIV>
<DIV>thanks,</DIV>
<DIV> </DIV>
<DIV>dali<BR><BR><B><I>David Cole <A class=moz-txt-link-rfc2396E href="mailto:david.cole@kitware.com"><david.cole@kitware.com></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> </P>
<P>i want use vtkBMPReader but not directly on the files </P>
<P> instead of passing the prefix of slices can i pass the array data of pixels to vtkBMPReader</P><FONT size=2><FONT size=2>
<P>/* </P>
<P>bmp= vtkBMPReader::New();</P></FONT></FONT>
<P><FONT size=2>bmp->SetFilePrefix (prefix);</FONT></P>
<P><FONT size=2>bmp->SetFileNameSliceOffset(1);</FONT></P>
<P><FONT size=2>bmp->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>