[vtkusers] .RAW file
Massinissa Bandou
Massinissa.Bandou at USherbrooke.ca
Tue Jul 9 10:25:46 EDT 2013
Hello everyone,
I tried to read a (.raw) file with the following code but it displays a RED
CUBE. Here is some information about my file dataInfo.txt
<http://vtk.1045678.n5.nabble.com/file/n5721842/dataInfo.txt> . Is there
something wrong in my code?
thx for your time and help!
sorry my file is too large to be send.
#include <vtkSmartPointer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkActor>
#include <vtkImageReader>
#include <vtkDataSetMapper>
int main(int argc, char *argv[])
{
vtkImageReader *reader = vtkImageReader::New();
reader->SetFileName(file.c_str());
reader->SetFileDimensionality(3);
reader->SetNumberOfScalarComponents(1);
reader->SetDataExtent(0,512,0,512,0,512);
reader->SetDataSpacing(0.145, 0.145, 0.145);
reader->SetDataByteOrderToBigEndian();
reader->SetDataScalarTypeToChar();
reader->Update();
vtkSmartPointer<vtkDataSetMapper> map =
vtkSmartPointer<vtkDataSetMapper>::New();
map->SetInputConnection(reader->GetOutputPort());
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(map);
vtkSmartPointer<vtkRenderWindowInteractor> interactor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
interactor->SetRenderWindow(renderWindow);
vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
renderWindow->AddRenderer(renderer);
renderer->AddActor(actor);
renderWindow->Render();
interactor->Start();
}
--
View this message in context: http://vtk.1045678.n5.nabble.com/RAW-file-tp5721842.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list