[Insight-users] Help to Read jpg image reader

yasser salman yass71 at yahoo.com
Tue Nov 27 07:11:32 EST 2012


Hi, 
i wanna to read a series of jpg images, the files named as 0001.01.jpg, 0002.01.jpg,0003.01.jpg,......., so i used the following lines to read the series and get error " can't open file 97452109.010.jpg , 
 
this is my code:
 vtkJPEGReaderjpegreader = newvtk.vtkJPEGReader();
jpegreader.SetFilePattern("%d.01.jpg");
jpegreader.SetFilePrefix("D:\\cryofull\\coronal\\");
jpegreader.SetFileNameSliceOffset(1);
jpegreader.SetFileNameSliceSpacing(0);
jpegreader.SetDataSpacing(1, 1, 1);
jpegreader.SetDataOrigin(0, 0, 0);
jpegreader.SetDataExtent(0, 1035, 0, 1476, 0, 1361);
jpegreader.SetDataScalarTypeToUnsignedChar();
vtk.vtkFixedPointVolumeRayCastMappertexMapper = newvtk.vtkFixedPointVolumeRayCastMapper();
vtkVolumevol = newvtkVolume();
vtkColorTransferFunctionctf = newvtkColorTransferFunction();
vtkPiecewiseFunctionspwf =newvtkPiecewiseFunction();
vtkPiecewiseFunctiongpwf = newvtkPiecewiseFunction();
gaussian.SetStandardDeviations (1.0, 1.0, 1.0);
gaussian.SetRadiusFactors (1.0, 1.0, 1.0);
gaussian.SetInput(jpegreader.GetOutput());
 
texMapper.SetInputConnection(gaussian.GetOutputPort());
 
spwf.AddPoint(84, 0);
spwf.AddPoint(151, .1);
spwf.AddPoint(255, 1);
 
gpwf.AddPoint(0, .2);
gpwf.AddPoint(10, .2);
gpwf.AddPoint(25, 1);
// vol.GetProperty().SetColor(ctf);
vol.GetProperty().SetScalarOpacity(spwf);
vol.GetProperty().SetGradientOpacity(gpwf);
vol.SetMapper(texMapper);
//Go through the Graphics Pipeline 
aRenderer.AddVolume(vol);
aRenderer.ResetCamera();
this.vtkFormsWindowControl1.Visible = true;
this.vtkFormsWindowControl1.Update();
renWin = 
this.vtkFormsWindowControl1.GetRenderWindow();
aRenderer.SetBackground(0, 255, 0);
renWin.AddRenderer(aRenderer);
renWin.SetInteractor(iren);
iren.Initialize();
renWin.Render();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121127/9dae96b0/attachment.htm>


More information about the Insight-users mailing list