[vtkusers] Bug in vtkImageviewer2 when one of the image dimension exeeds 512!!!

lydia safid safid_lydia at yahoo.fr
Mon Jul 4 06:18:21 EDT 2005




Hello
I have posted 4 months ago, a bug concerning vtkImageviewer2, the bug ID is 1641, I was wondering when will it be fixed
thanks
Lydia

lydia safid <safid_lydia at yahoo.fr> a écrit :



Hi Folks!

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!!

Below is my code, I tried to attach the images but it could not be posted by the mailing list

you will notice the following:

1. With vtkImageViewer2, the display is not corret (the second dimension of the image is 611)

2. If you use vtkImageViewer instead of vtkImageViewer2, it will properly..( Strange! isn't it?)

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...

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

Thanks in advance

#include "vtkStructuredPointsReader.h"

#include "vtkStructuredPoints.h"

#include "vtkImageImport.h"

#include "vtkImageViewer.h"

#include "vtkImageViewer2.h"

 

void main ()

{

vtkStructuredPointsReader *reader=vtkStructuredPointsReader::New();

reader->SetFileName("C:/TEMP/MRI.vtk");

reader->Update();

int dim[3]; double spacing [3];

reader->GetOutput()->GetDimensions(dim);

reader->GetOutput()->GetSpacing(spacing);

vtkStructuredPoints *dcm_volume=vtkStructuredPoints::New();

dcm_volume->SetDimensions(dim[0],dim[1],dim[2]);

dcm_volume->SetScalarType(VTK_UNSIGNED_CHAR);

dcm_volume->SetNumberOfScalarComponents(1);

dcm_volume->AllocateScalars();

dcm_volume->DeepCopy(reader->GetOutput());

vtkImageViewer2 *viewer = vtkImageViewer2::New();

int i=0;

while (i<dim[2])

{

unsigned char *vol1= new unsigned char[(dim[0]*dim[1])/sizeof( unsigned char)];

memmove(vol1, (unsigned char *)dcm_volume->GetScalarPointer()+i*(dim[0]*dim[1]),dim[0]*dim[1]);



vtkImageImport *importer_pro=vtkImageImport::New();

importer_pro->SetWholeExtent(0,dim[0]-1,0,dim[1]-1,1,1);

importer_pro->SetDataExtent(0,dim[0]-1,0,dim[1]-1,1,1);

importer_pro->SetDataSpacing(1,1,1);

importer_pro->SetDataOrigin(0, 0,0);

importer_pro->SetDataScalarType(VTK_UNSIGNED_CHAR);

importer_pro->SetNumberOfScalarComponents(1);

importer_pro->SetImportVoidPointer((unsigned char *) vol1);

importer_pro->Update();



viewer->SetSize(500,500);

viewer->SetInput(importer_pro->GetOutput() );

viewer->SetZSlice(1);

viewer->SetColorWindow(255);

viewer->SetColorLevel(127.5);

viewer->Render();

i++;

delete [] vol1;

importer_pro->Delete();

}

}




---------------------------------
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail

> ATTACHMENT part 2 application/x-zip-compressed name=MRI.zip



---------------------------------
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers


---------------------------------
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez le ici ! 

		
---------------------------------
 Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
 Téléchargez le ici !  
		
---------------------------------
 Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
 Téléchargez le ici !  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050704/d30a0c54/attachment.htm>


More information about the vtkusers mailing list