<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7100.18"></HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px"
id=MailContainerBody leftMargin=0 topMargin=0 CanvasTabStop="true"
name="Compose message area">
<DIV><FONT face=Calibri>Hi All,</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>I have a small python VTK function (pasted in at the
bottom of this email) that calculates the volume and surface area of
an object embedded in a stack of TIFF images. To read the TIFFs into VTK I
have used vtkTIFFReader and processed the result using vtkImageThreshold and
vtkImageGaussianSmooth libraries. I then use vtkMassProperties to extract
the volume and surface area of the object identified after smoothing and
thresholding. </FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>With VTK-5.04, this function returns the correct value
for a test stack (3902 pixels). However, the same function returns a different
value (422 pixels) when I run it using VTK-5.4.2. Can someone explain
this.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>Thank you in advance for all your
responses/help</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>Azim</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>Python Code Below</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>### Start File ###</FONT></DIV>
<DIV><CODE>import vtk</CODE></DIV>
<DIV><CODE>def testvtk():<BR> # read 36 TIFF images. Each TIFF
is 27x27 pixels<BR>
v16=vtk.vtkTIFFReader()<BR>
v16.SetFilePrefix("d:/test/slice")<BR>
v16.SetDataExtent(0,27,0,27,1,36)<BR>
v16.SetFilePattern("%s%04d.tif")<BR> v16.SetDataSpacing
(1,1,1)<BR> v16.Update()<BR><BR> # Threshold
level for seperating background/foreground pixels<BR>
maxthres=81<BR><BR> # Threshold the image
stack<BR> thres=vtk.vtkImageThreshold()<BR>
thres.SetInputConnection(v16.GetOutputPort())<BR>
thres.ThresholdByLower(0)<BR>
thres.ThresholdByUpper(maxthres)<BR><BR> # create ISO surface
from thresholded images<BR>
iso=vtk.vtkImageMarchingCubes()<BR>
iso.SetInputConnection(thres.GetOutputPort())<BR><BR> # Have
VTK calculate the Mass (volume) and surface area<BR> Mass =
vtk.vtkMassProperties()<BR>
Mass.SetInputConnection(iso.GetOutputPort())<BR> Mass.Update()
<BR><BR> # just print the results<BR> print
"Volume = ", Mass.GetVolume() <BR> print "Surface = ",
Mass.GetSurfaceArea()<BR></CODE></DIV>
<DIV><CODE><FONT face="Courier New">testvtk</FONT></CODE></DIV>
<DIV><CODE><FONT face="Courier New">### End File
###</FONT></DIV></CODE></BODY></HTML>