[vtkusers] 3D reconstruction using 2d tiff images

Ioannis Conou ioannisconou at gmail.com
Mon Jun 16 12:29:16 EDT 2008


Hi Flory,


Thanks Flory. I used this code and the problem with vtkTIFFReader is solved.
I haven't got any Error.



vtkTIFFReader reader = new vtkTIFFReader();

reader.SetFileDimensionality(2);

reader.SetFilePrefix("C:\\Data\\3Daxial\\t8a");

reader.SetFilePattern("%s%02d.tif");

reader.SetFileNameSliceOffset(0);

reader.SetDataExtent(0, 512, 0, 512, 0, 27);

reader.SetDataSpacing(0.1, 0.1, 0.5);

reader.SetDataOrigin(0.0, 0.0, 0.0);

reader.Update();



But I still have a problem with the rendering. I don't see of my data in the
rendering window.  I see only some strange polygons and I don't Know what's
the fault.



This is my Java Code.



vtkImageGaussianSmooth gsmooth = new vtkImageGaussianSmooth();

    gsmooth.SetInput(reader.GetOutput());

    gsmooth.SetStandardDeviation(sdev[0], sdev[1], sdev[2]);

    gsmooth.SetRadiusFactors(radius[0], radius[1], radius[2]);

    gsmooth.SetDimensionality(3);

    gsmooth.Update();



        vtkImageShrink3D mask = new vtkImageShrink3D();

        mask.SetInput(gsmoouth.GetOutput());

        mask.SetShrinkFactors(5, 5, 5);



        vtkMarchingCubes iso = new vtkMarchingCubes();

        iso.SetInput(mask.GetOutput());

        iso.SetValue(0, 150); //(0,150)

        iso.ComputeGradientsOn();

        iso.ComputeScalarsOff();

        iso.SetLocator(locator);



        vtkVectorNorm gradient = new vtkVectorNorm();

        gradient.SetInput(iso.GetOutput());



        vtkDataSetMapper isoMapper = new vtkDataSetMapper();

        isoMapper.SetInput(gradient.GetOutput());

        isoMapper.ScalarVisibilityOn();

        isoMapper.SetScalarRange(0, 600); //(0,300)

        isoMapper.ImmediateModeRenderingOn();





        vtkActor isoActor = new vtkActor();

        isoActor.SetMapper(isoMapper);

        isoActor.GetProperty().SetColor(100, 100, 100);



        vtkOutlineFilter outline = new vtkOutlineFilter();

        outline.SetInput(reader.GetOutput());

        vtkPolyDataMapper outlineMapper = new vtkPolyDataMapper();

        outlineMapper.SetInput(outline.GetOutput());

        vtkActor outlineActor = new vtkActor();

        outlineActor.SetMapper(outlineMapper);



        ren1.AddActor(outlineActor);

        ren1.AddActor(isoActor);

        ren1.AddLight(lgt);

        renWin.SetSize(1000, 1000);

        ren1.SetBackground(0, 0, 0.4);



        vtkCamera cam1 = ren1.GetActiveCamera();

        cam1.Elevation(600);

        cam1.SetViewUp(0, 0, 1.0);

        cam1.Zoom(0.5);

        cam1.SetDistance(300);

        lgt.SetPosition(cam1.GetPosition());

        lgt.SetFocalPoint(cam1.GetFocalPoint());



        ren1.ResetCameraClippingRange();



        renWin.Render();

        iren.Start();



Thank Elena and Amy for the reply.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080616/7a486ae3/attachment.htm>


More information about the vtkusers mailing list