[vtkusers] Re: build TIFF-images to a volume?
Jeremy Winston
jbw at ieee.org
Tue Feb 8 20:27:10 EST 2005
Kevin H. Hobbs wrote:
> On Sat, 2005-02-05 at 10:20 +0100, Stephan Theisen wrote:
>>
>>I've a lot of 2D images in the tiff format. These images are from a
>>medical CT Dataset. Now I want to visualizise
>>them in a volume. How can I put the slices together?
If you have Tcl installed, and your files are named
basenameN.tif
where NN is between 1 & 50 inclusive, try this:
# --- Begin: ---
vtkTIFFReader tReader
tReader SetFilePrefix "Path/To/Your/Data/Files/basename"
tReader SetFilePattern "%s%i.tif" ;# I.e., {Prefix}{Image#}.tif
tReader SetImageRange 1 50 ;# Slice numbers
tReader SetDataSpacing 0.33 0.33 1.0 ;# x,y,z pixel spacing
tReader SetDataOrigin 0 0 0
vtkContourFilter sfcExtractor
sfcExtractor SetInput [tReader GetOutput]
sfcExtractor SetValue 0 500
vtkPolyDataNormals sfcNormals
sfcNormals SetInput [sfcExtractor GetOutput]
sfcNormals SetFeatureAngle 60.0
vtkPolyDataMapper sfcMapper
sfcMapper SetInput [sfcNormals GetOutput]
sfcMapper ScalarVisibilityOff
vtkActor sfc
sfc SetMapper skinMapper
vtkRenderer aRenderer
vtkRenderWindow renWin
renWin AddRenderer aRenderer
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
aRenderer AddActor sfc
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize
wm withdraw .
# --- End. ---
or something like that.
You'll probably have to fiddle with the contour filter
threshold values as appropriate for your data.
Check out the example Tcl files for more ideas.
HTH,
-Jeremy
More information about the vtkusers
mailing list