[vtkusers] Creating a 3DImageData from slices

Amy Squillacote ahs at cfdrc.com
Wed May 28 10:31:10 EDT 2008


What is the scalar range of your data? The color window and level need 
to be set based on this range. You can get the scalar range as follows.

transfo3D->Update();
double range[2];
transfo3D->GetOutput()->GetPointData()->GetScalars()->GetRange(range);

Try setting the color window to "range[1] - range[0]". Set the color 
level to the middle of that range: "(range[0]+range[1])*0.5".

- Amy

Romuald BERTRAND wrote:
>
> I'm not very familiar with vtk, I have tried this :
>
> /    viewer->SetInputConnection(transfo3D->GetOutputPort());
>     viewer->SetSlice(lastOne);
>     viewer->SetColorWindow(2000);
>     viewer->SetColorLevel(1000);
>    
>     Refresh();/
>
>
>
>
>
>     > Message du 28/05/08 16:15
>     > De : "Amy Squillacote"
>     > A : "Romuald BERTRAND"
>     > Copie à : vtkusers at vtk.org
>     > Objet : Re: [vtkusers] Creating a 3DImageData from slices
>     >
>     > How are you displaying the volume?
>     > - Amy
>     >
>     > Romuald BERTRAND wrote:
>     > >
>     > > Hi Amy,
>     > >
>     > > Thanks for your help, but I have already tried this loop, just
>     after
>     > > sending the email. And when I display the volume, it doesn't
>     appear
>     > > (just a black screen). Do you know why?
>     > >
>     > > Thanks for your help,
>     > >
>     > > Romu
>     > >
>     > >
>     > >
>     > >
>     > >
>     > > > Message du 28/05/08 15:44
>     > > > De : "Amy Squillacote"
>     > > > A : "Romuald BERTRAND"
>     > > > Copie à : vtkusers at vtk.org
>     > > > Objet : Re: [vtkusers] Creating a 3DImageData from slices
>     > > >
>     > > > Hi Romu,
>     > > >
>     > > > Try replacing your "for" loop with the following. (You also
>     > > won't need
>     > > > "int importPort(0);".)
>     > > >
>     > > > for (int i = 0; i < lastOne; i++)
>     > > > {
>     > > > transfo3D->AddInput(img[i]);
>     > > > }
>     > > >
>     > > > - Amy
>     > > >
>     > > > Romuald BERTRAND wrote:
>     > > > >
>     > > > > Hi, my code is :
>     > > > >
>     > > > > / vtkImageAppend* transfo3D = vtkImageAppend::New();
>     > > > >
>     > > > > int inputPort(0);
>     > > > >
>     > > > > for( int i=0; i
>     > > > > {
>     > > > > transfo3D->SetInput(inputPort, img[i]);
>     > > > >
>     > > > > inputPort++;
>     > > > > }
>     > > > >
>     > > > > transfo3D->SetAppendAxis(2);
>     > > > >
>     > > > > viewer->SetInputConnection(transfo3D->GetOutputPort());
>     > > > > viewer->SetSlice(lastOne);
>     > > > > viewer->SetColorWindow(2000);
>     > > > > viewer->SetColorLevel(1000);
>     > > > >
>     > > > > Refresh();
>     > > > > /
>     > > > > I think there is a lot of errors, but I don't know how to use
>     > > this class.
>     > > > >
>     > > > > Thanks for help
>     > > > >
>     > > > > Romu
>     > > > >
>     > > > >
>     > > > >
>     > > > >
>     > > > >
>     > > > > > Message du 27/05/08 16:36
>     > > > > > De : "Amy Squillacote"
>     > > > > > A : "Romuald BERTRAND"
>     > > > > > Copie à : vtkusers at vtk.org
>     > > > > > Objet : Re: [vtkusers] Creating a 3DImageData from slices
>     > > > > >
>     > > > > > Hi Romu,
>     > > > > >
>     > > > > > Please post source code showing how you are trying to use
>     > > > > > vtkImageAppend. In order for anyone on this list to help you
>     > > > > track down
>     > > > > > the problem, we need to see source code showing what you are
>     > > doing.
>     > > > > >
>     > > > > > - Amy
>     > > > > >
>     > > > > > Romuald BERTRAND wrote:
>     > > > > > >
>     > > > > > > Hi Amy, thanks for your answer,
>     > > > > > >
>     > > > > > > But I have tried to make an algorithm with
>     "vtkImageAppend",
>     > > > > and I
>     > > > > > > don't arrived.
>     > > > > > > Someone know how can I use this class?
>     > > > > > > I have severals 2D vtkImageData objects (the slices).
>     > > > > > >
>     > > > > > > Thanks a lot for answers.
>     > > > > > >
>     > > > > > > Romu
>     > > > > > >
>     > > > > > >
>     > > > > > >
>     > > > > > >
>     > > > > > >
>     > > > > > > > Message du 22/05/08 17:10
>     > > > > > > > De : "Amy Squillacote"
>     > > > > > > > A : "Romuald BERTRAND"
>     > > > > > > > Copie à : vtkusers at vtk.org
>     > > > > > > > Objet : Re: [vtkusers] Creating a 3DImageData from
>     slices
>     > > > > > > >
>     > > > > > > > Hi Romu,
>     > > > > > > >
>     > > > > > > > Are the slices already loaded in VTK (i.e., multiple 2D
>     > > > > > > vtkImageData
>     > > > > > > > objects), or are you reading the slices from files?
>     > > > > > > >
>     > > > > > > > If they're already 2D vtkImageData objects, take a
>     look at
>     > > > > > > > vtkImageAppend
>     > > > > > > >
>     > > (http://www.vtk.org/doc/nightly/html/classvtkImageAppend.html).
>     > > > > > > If you
>     > > > > > > > have X-Y slices, then the "append axis" should be the Z
>     > > axis.
>     > > > > > > >
>     > > > > > > > If you're reading the slices from files, subclasses of
>     > > > > > > vtkImageReader2
>     > > > > > > >
>     > > (http://www.vtk.org/doc/nightly/html/classvtkImageReader2.html)
>     > > > > > > will
>     > > > > > > > handle this for you. You can pass in either a list of
>     > > file names
>     > > > > > > or a
>     > > > > > > > file pattern to tell the reader how to get the data
>     files.
>     > > > > > > >
>     > > > > > > > - Amy
>     > > > > > > >
>     > > > > > > > Romuald BERTRAND wrote:
>     > > > > > > > >
>     > > > > > > > > Hi all,
>     > > > > > > > >
>     > > > > > > > > Someone know how creating a 3DImageData from 2D
>     slices?
>     > > > > > > > > Thanks for answers,
>     > > > > > > > >
>     > > > > > > > > Romu
>     > > > > > > > >
>     > > > > > > > >
>     > > > > > >
>     > > > >
>     > >
>     ------------------------------------------------------------------------
>     > > > > > > > >
>     > > > > > > > > _______________________________________________
>     > > > > > > > > This is the private VTK discussion list.
>     > > > > > > > > Please keep messages on-topic. Check the FAQ at:
>     > > > > > > http://www.vtk.org/Wiki/VTK_FAQ
>     > > > > > > > > Follow this link to subscribe/unsubscribe:
>     > > > > > > > > http://www.vtk.org/mailman/listinfo/vtkusers
>     > > > > > > > >
>     > > > > > > >
>     > > > > > > > --
>     > > > > > > > Amy Squillacote Phone: (256) 726-4839
>     > > > > > > > Computer Scientist Fax: (256) 726-4806
>     > > > > > > > CFD Research Corporation Web: http://www.cfdrc.com
>     > > > > > > > 215 Wynn Drive, Suite 501
>     > > > > > > > Huntsville, AL 35805
>     > > > > > > >
>     > > > > > > >
>     > > > > > > >
>     > > > > > > >
>     > > > > > >
>     > > > > >
>     > > > > > --
>     > > > > > Amy Squillacote Phone: (256) 726-4839
>     > > > > > Computer Scientist Fax: (256) 726-4806
>     > > > > > CFD Research Corporation Web: http://www.cfdrc.com
>     > > > > > 215 Wynn Drive, Suite 501
>     > > > > > Huntsville, AL 35805
>     > > > > >
>     > > > > >
>     > > > > >
>     > > > > >
>     > > > >
>     > > >
>     > > > --
>     > > > Amy Squillacote Phone: (256) 726-4839
>     > > > Computer Scientist Fax: (256) 726-4806
>     > > > CFD Research Corporation Web: http://www.cfdrc.com
>     > > > 215 Wynn Drive, Suite 501
>     > > > Huntsville, AL 35805
>     > > >
>     > > >
>     > > >
>     > > >
>     > >
>     >
>     > --
>     > Amy Squillacote Phone: (256) 726-4839
>     > Computer Scientist Fax: (256) 726-4806
>     > CFD Research Corporation Web: http://www.cfdrc.com
>     > 215 Wynn Drive, Suite 501
>     > Huntsville, AL 35805
>     >
>     >
>     >
>     >
>

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805





More information about the vtkusers mailing list