[vtkusers] 3D reconstruction using 2d tiff images

Ioannis Conou ioannisconou at gmail.com
Sun Jun 15 12:36:21 EDT 2008


Hi, vtk users.

I have a question in terms of 3D reconstruction using 2d tiff images.
I have 30 serial rat brain section images(RGB) size (512x512). I
rename them (t8a.0,t8a.01, t8a.02-----t8a.30) and I tried to load
these 30 images and reconstruct a 3D structure.
When I render, I only see just background in rendering window. There
is nothing in my rendering window and I get this
ERROR: In ..\..\vtk\IO\vtkTIFFReader.cxx, line 178
vtkTIFFReader (03D76AE8): Unable to open file C:\Data\3Daxial\.0

This is Java code what I used.

vtkRenderer ren1 = new vtkRenderer();
        vtkRenderWindow renWin = new vtkRenderWindow();
        renWin.AddRenderer(ren1);
        vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow(renWin);
        vtkLight lgt = new vtkLight();

        vtkMergePoints locator = new vtkMergePoints();
        locator.SetDivisions(32, 32, 46); //(32,32,46)
        locator.RetainCellListsOff();
        locator.SetNumberOfPointsPerBucket(2);
        locator.AutomaticOff();

        vtkTIFFReader reader = new vtkTIFFReader();
        reader.SetFilePrefix("C:\\Data\\3Daxial\\");

        vtkImageShrink3D mask = new vtkImageShrink3D();
        mask.SetInput(reader.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();

I haven't  got much experience in VTK.
Is there anybody who can help me....? Please.



More information about the vtkusers mailing list