[vtkusers] Problem Image Reader/Viewer?

Glen Lehmann glehmann at imaging.robarts.ca
Tue Jun 3 10:17:16 EDT 2003


Hi Oliver,

Try inserting this:

imageData->UpdateWholeExtent()

before you call imageData->GetOutput().  Also, you'll probably want to 
change this line:

imagedata->SetDataScalarType(imagedata->GetDataScalarType ());

to explicitly set your scalar type. 

i.e.

imagedata->SetDataScalarTypeToUnsignedChar();

Good luck,
Glen



oliveira at alumni.deec.uc.pt wrote:

>Hi,
>
>I have a file (binary) with a simple 7x7 matrix (integers 0-10), with no
>header.
>I want to display that data (as image), like we do in matlab.
>I use that code and only have a black image.
>How can I view that data?
>Are there any diferent classes to use in this case not vtkImageReader or
>Viewer?
>
>Thanks.
>
>vtkImageReader *imagedata = vtkImageReader::New();
>
>imagedata->SetFileName(filename);
>imagedata->SetDataOrigin(0.0,0.0,0.0);
>imagedata->SetNumberOfScalarComponents(1);
>imagedata->SetDataScalarType(imagedata->GetDataScalarType ());
>imagedata->SetDataExtent(0,7,0,7,0,0);
>imagedata->SetDataSpacing(1.0,1.0,1.0);
>
>vtkImageViewer *viewer=vtkImageViewer::New();
>viewer->SetInput(imagedata->GetOutput() );
>viewer->Render();
>
>
>
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
>
>  
>





More information about the vtkusers mailing list