[vtkusers] Reading RAW format in vtk4?

Mahmoud El-Banna elbanna_m at hotmail.com
Tue Jun 4 14:24:08 EDT 2002


hello;
i use the following code in vtk4 as an upgraded version	of a certain code 
segment in reading raw format,the application runs perfectly in the old 
version, after upgrading there is no compilation error but the application 
stops with a run time error, i use vc++6 under windows xp,and the upgraded 
code is in the same logic as the old code

any help will be appreciated

*****************************code***********************
CString	m_FileName;
        char STUDY[100];
	int length=m_FileName.GetLength();

	for(int i=0;i<length;i++)
		{
			if(m_FileName[i]=='.')break;
		}
		m_FileName=m_FileName.Left(i);
		strcpy(STUDY,m_FileName);
		vtkVolume16Reader *reader=vtkVolume16Reader ::New();
		reader->SetFilePrefix(STUDY);
		ROW=512;
		COL=512;
		reader->SetDataDimensions(512,512);
		reader->SetDataByteOrderToBigEndian();
		reader->SetHeaderSize(3416);
		vtkStructuredPoints *sp=vtkStructuredPoints ::New();
		scalar=vtkFloatArray :: New();
		sp=reader->GetImage (1);
	scalar = (vtkFloatArray*) sp->GetPointData()->GetScalars();
		int sc=0;
		UpdateData(true);
		sp->GetPointData()->SetScalars(scalar);
		int *dim=sp->GetDimensions ();
	//	vtkStructuredPointsToImage     *toImage=vtkStructuredPointsToImage 
::New();
	//	toImage->SetInput(sp);
		vtkImageViewer *viewer = vtkImageViewer :: New();
		viewer-> SetInput (sp);
		viewer->SetColorWindow (1000);
		viewer->SetColorLevel (1000);
// Image display
		vtkImageMapper *mapper=vtkImageMapper::New();
		mapper->SetInput(sp);
		vtkActor2D *actor=vtkActor2D::New();
		actor->SetMapper (mapper);
		vtkRenderer *ren1=vtkRenderer::New();
		vtkRenderWindow *renWin=vtkRenderWindow::New();
		renWin->AddRenderer (ren1);
		iren=vtkRenderWindowInteractor::New();
	       iren->SetRenderWindow (renWin);
		ren1->AddActor(actor);
		renWin->SetSize (425,425);
		iren->Initialize();
		int * pos;
		pos=iren->GetEventPosition ();
		m_window1=pos[0];
		m_level1 =pos[1];
		UpdateData(false);


Mahmoud El-Banna


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com




More information about the vtkusers mailing list