<DIV><BR><BR>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<DIV>
<DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<P>Hi Folks!</P>
<P>I already posted a mail concerning this problem but now I am quite sure that the problem is in the class vtkImageViewer2. This class cannot display images when either the width or the height exceeds 512!!</P>
<P>Below is my code, I tried to attach the images but it could not be posted by the mailing list</P>
<P>you will notice the following:</P>
<P>1. With vtkImageViewer2, the display is not corret (the second dimension of the image is 611)</P>
<P>2. If you use vtkImageViewer instead of vtkImageViewer2, it will properly..( Strange! isn't it?)</P>
<P>3. Another remark, if you replace i by 5 for example or any number less than dim[2], and if you set up a breakpoint after viewer->Render(), you will notive that the first display is done properly, then if you continue inside the "while", the same image will not be displayed properly...</P>
<P>Hope all these information will help you to help me because I spent so many time in debugging my program thinking that the bug was from me.... So, If you already experienced the problem, please let me know about it it is urgent</P>
<P>Thanks in advance</P><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkStructuredPointsReader.h"</P></FONT><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkStructuredPoints.h"</P></FONT><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkImageImport.h"</P></FONT><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkImageViewer.h"</P></FONT><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkImageViewer2.h"</FONT></P>
<P><FONT size=2></FONT> </P><FONT color=#0000ff size=2>
<P>void</FONT><FONT size=2> main ()</P>
<P>{</P>
<P>vtkStructuredPointsReader *reader=vtkStructuredPointsReader::New();</P>
<P>reader->SetFileName("C:/TEMP/MRI.vtk");</P>
<P>reader->Update();</P>
<P></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> dim[3]; </FONT><FONT color=#0000ff size=2>double</FONT><FONT size=2> spacing [3];</P>
<P>reader->GetOutput()->GetDimensions(dim);</P>
<P>reader->GetOutput()->GetSpacing(spacing);</P>
<P>vtkStructuredPoints *dcm_volume=vtkStructuredPoints::New();</P>
<P>dcm_volume->SetDimensions(dim[0],dim[1],dim[2]);</P>
<P>dcm_volume->SetScalarType(VTK_UNSIGNED_CHAR);</P>
<P>dcm_volume->SetNumberOfScalarComponents(1);</P>
<P>dcm_volume->AllocateScalars();</P>
<P>dcm_volume->DeepCopy(reader->GetOutput());</P>
<P>vtkImageViewer2 *viewer = vtkImageViewer2::New();</P></FONT><FONT color=#0000ff size=2>
<P>int</FONT><FONT size=2> i=0;</P></FONT><FONT color=#0000ff size=2>
<P>while</FONT><FONT size=2> (i<dim[2])</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2> *vol1= </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2>[(dim[0]*dim[1])/</FONT><FONT color=#0000ff size=2>sizeof</FONT><FONT size=2>( </FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2>)];</P>
<P>memmove(vol1, (</FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2> *)dcm_volume->GetScalarPointer()+i*(dim[0]*dim[1]),dim[0]*dim[1]);</P>
<P></P>
<P>vtkImageImport *importer_pro=vtkImageImport::New();</P>
<P>importer_pro->SetWholeExtent(0,dim[0]-1,0,dim[1]-1,1,1);</P>
<P>importer_pro->SetDataExtent(0,dim[0]-1,0,dim[1]-1,1,1);</P>
<P>importer_pro->SetDataSpacing(1,1,1);</P>
<P>importer_pro->SetDataOrigin(0, 0,0);</P>
<P>importer_pro->SetDataScalarType(VTK_UNSIGNED_CHAR);</P>
<P>importer_pro->SetNumberOfScalarComponents(1);</P>
<P>importer_pro->SetImportVoidPointer((</FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2> *) vol1);</P>
<P>importer_pro->Update();</P>
<P></P>
<P>viewer->SetSize(500,500);</P>
<P>viewer->SetInput(importer_pro->GetOutput() );</P>
<P>viewer->SetZSlice(1);</P>
<P>viewer->SetColorWindow(255);</P>
<P>viewer->SetColorLevel(127.5);</P>
<P>viewer->Render();</P>
<P>i++;</P>
<P></FONT><FONT color=#0000ff size=2>delete</FONT><FONT size=2> [] vol1;</P>
<P>importer_pro->Delete();</P></FONT>
<P><FONT size=2>}</FONT></P>
<P><FONT size=2>}</P></FONT></BLOCKQUOTE></DIV></DIV>
<P>
<HR SIZE=1>
Découvrez le nouveau Yahoo! Mail : <FONT color=red>250 Mo d'espace</FONT> de stockage pour vos mails !<BR><A href="http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/evt=25917/*http://fr.rd.yahoo.com/mail_fr/mail_campaigns/splash/taglines_250/default/*http://fr.promotions.yahoo.com/mail/creer28.html">Créez votre Yahoo! Mail</A><BR><BR>> ATTACHMENT part 2 application/x-zip-compressed name=MRI.zip<BR></BLOCKQUOTE></DIV><p>
                <hr size=1>
Découvrez le nouveau Yahoo! Mail : <font color="red">250 Mo d'espace</font> de stockage pour vos mails !<br><a href="http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/evt=25917/*http://fr.rd.yahoo.com/mail_fr/mail_campaigns/splash/taglines_250/default/*http://fr.promotions.yahoo.com/mail/creer28.html">Créez votre Yahoo! Mail</a>