<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Hello</DIV>
<DIV>I am trying to save resliced result to local bitmap file. But it gives me a picture filled with white color. I can see the correct result if use vtkImageViewer to view it. My input is mhd file. Its content is :</DIV>
<DIV> ObjectType = Image<BR> NDims = 3<BR> BinaryData = True<BR> BinaryDataByteOrderMSB = False<BR> CompressedData = False<BR> TransformMatrix = 1 0 0 0 1 0 0 0 1<BR> Offset = 0 0 0<BR> CenterOfRotation = 0 0 0<BR> ElementSpacing = 0.390625 0.390625 0.75<BR> DimSize = 512 512 227<BR> ElementType = MET_UCHAR<BR> ElementDataFile = CTRaw.raw<BR></DIV>
<DIV>My test program is:</DIV>
<DIV> vtk.vtkMetaImageReader v16 = new vtk.vtkMetaImageReader();<BR> v16.SetFileName(@"C:\vtk-dotnet\vtkdata-5.4.2\CTRaw.mhd");<BR> v16.Update();<BR> vtk.vtkMetaImageReader reader1 = v16;</DIV>
<DIV> vtkImageCast readerImageCast = new vtkImageCast();<BR> readerImageCast.SetInputConnection(reader1.GetOutputPort());<BR> readerImageCast.SetOutputScalarTypeToUnsignedInt();<BR> readerImageCast.ClampOverflowOn();</DIV>
<DIV> vtkTransform t1 = new vtkTransform();<BR> t1.PostMultiply();<BR> t1.RotateX(45);<BR> t1.RotateY(45);<BR> t1.RotateZ(30);<BR> vtkImageReslice res = new vtkImageReslice();<BR> res.SetInputConnection(readerImageCast.GetOutputPort());<BR> res.SetResliceAxesDirectionCosines(0, -1, 0, 0, 0, -1, 1, 0, 0);<BR> res.SetResliceAxesOrigin(0, 0,
0);<BR> res.SetResliceTransform(t1);<BR> res.InterpolateOn();<BR> res.SetInterpolationModeToCubic();<BR> res.SetOutputSpacing(1, 1, 1);<BR> res.SetBackgroundLevel(1023);</DIV>
<DIV> vtkImageShiftScale m_displayImage = new vtkImageShiftScale();<BR> m_displayImage.SetInput(res.GetOutput());<BR> m_displayImage.SetOutputScalarTypeToUnsignedChar();<BR> vtkImageMapToWindowLevelColors m_displayWindowLevelColorsImage = new vtkImageMapToWindowLevelColors();</DIV>
<DIV> m_displayWindowLevelColorsImage.SetInput(m_displayImage.GetOutput());<BR> m_displayWindowLevelColorsImage.SetWindow(200);<BR> m_displayWindowLevelColorsImage.SetLevel(750);</DIV>
<DIV> vtkBMPWriter writer = new vtkBMPWriter();<BR> writer.SetInput(m_displayImage.GetOutput());<BR> writer.SetFileName("c:/testt.bmp");<BR> writer.Update();</DIV>
<DIV> </DIV>
<DIV>Thanks!</DIV>
<DIV> </DIV>
<DIV>zlf</DIV></div><br>
<hr size=1><a href="http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/"> 好玩贺卡等你发,邮箱贺卡全新上线!</a></body></html>