[vtkusers] Problems about vtkMetaImageReader to read raw data

黄波 huangbo06 at gmail.com
Thu Mar 1 04:16:59 EST 2007


Hi All,
    Sorry to my poor english!  I wanted to render a volume data by reading some JPEG files, but I have a problem.
    Firstly, I used a software turn these JPEG files into a raw file(4.raw). 
    Secondly, I writed a mhd file(4.mhd) as follow:
           ObjectType = Image
           NDims = 3
           BinaryData = true
           BinaryDataByteOrderMSB = true
           DimSize = 587 1878 10
           ElementSpacing = 0.33 1 0.33
           Position = 0.0 0.0 0.0
           ElementNumberOfChannels = 3
           ElementType = MET_UCHAR
           ElementDataFile = 4.raw
    I can be sure that these parameters are right.
    Thirdly, to read the mhd file and set the transfer function: 
             vtkMetaImageReader *reader = vtkMetaImageReader::New();
           	   reader->SetFileName ("4.mhd");  
             vtkPiecewiseFunction *opacityTransferFunction = vtkPiecewiseFunction::New();
	           opacityTransferFunction->AddPoint(0,0.0);
	           opacityTransferFunction->AddPoint(255,1);
             vtkColorTransferFunction *colorTransferFunction = vtkColorTransferFunction::New();
	           colorTransferFunction->AddRGBPoint(0,0.0, 0.0, 0.0);
	           colorTransferFunction->AddRGBPoint(255,1.0, 1.0, 1.0);
     Unfortunately, I can not get the clear and accute result. My resulted picture is the same as the picture resulted from other softwares without considering the interlacing option. 
     I hope someone can tell me how to get the accute resulted picture by reading such raw file.
     Thanks! 
     
        mars
        huangbo06 at gmail.com
          2007-03-01


More information about the vtkusers mailing list