<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=ËÎÌå size=2>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I want to&nbsp;convert&nbsp;a &nbsp;java 3D 
array(threeDarray) to&nbsp;a vtkImageData object(image).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I do it use java as below:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkImageData 
image = new vtkImageData();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
image.SetDimensions(iWidth, iHeight, 
iNumImg);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; image.SetOrigin(0.0, 0.0, 
0.0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
image.SetSpacing(spacing[0],spacing[1],spacing[2]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
image.SetScalarType(5);</FONT></DIV>
<DIV><FONT size=2><BR><FONT face=Arial>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
vtkShortArray array = new 
vtkShortArray();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
array.SetNumberOfComponents(1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
array.SetNumberOfTuples(iWidth*iNumImg*iHeight);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</FONT></FONT></DIV><FONT size=2>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>&nbsp;&nbsp;&nbsp;&nbsp;int index = 
0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int iZ = 0; iY &lt; 
iNumImg; iZ++){</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
for(int iY= 0; iY &lt; iHeight; iY++){</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT 
face=Arial>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
for(int iX = 0; iX &lt; iWidth; iX++){</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT 
face=Arial>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
array.SetValue(index++,threeDarray[iZ][iY][iX]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}</FONT></DIV>
<DIV><FONT face=Arial>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV><FONT face=Arial>}</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>&nbsp;&nbsp;&nbsp;&nbsp; 
image.GetPointData().SetScalars(array);</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>However, it is very slow. To 256*256*256 slices it needs 
about 2 minutes to finish the loop.My computer has a high speed CPU and 1.2G 
memory. I need your help and any suggestion will be appreciated!</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>Best regards,</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>Yixun Liu</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV></FONT></FONT></DIV></BODY></HTML>