[Insight-users] How can I read a .raw file and save it as multi slices/files?

Luis Ibanez luis.ibanez at kitware.com
Fri Nov 6 08:14:29 EST 2009


Hi Phuong,

1) When you read the image using  the .mhd file that you posted,
    ITK is going to read it as a 3D volume (which is good).

2) You can then save the individual slices as DICOM slices,
    if you want. The program that you should use is:

        Insight/Examples/IO/ImageReadImageSeriesWrite.cxx
        if you want to save the slices as JPEG or PNG files.


    or

        Insight/Example/IO/ImageReadDicomSeriesWrite.cxx
        if you want to save the slices as DICOM files.

        and you don't need to worry about the meta data dictionary
        at this point, because you are not reading the image from
        DICOM anyways, so most of the specific tag values are
        actually not available.

3) If you see that the content of the slices look distorted,
    this may indicate that your values of

                         DimSize = 512 512 24

    are not quite correct.

    Please post a screenshot of the distorted images so that
    we can help you identify the source of the problem.



    Thanks


          Luis


-----------------------------------------------------------------------------------
On Tue, Nov 3, 2009 at 7:16 AM, phuong trinh pham ngoc
<equationsupertrinh at hotmail.com> wrote:
> Hello everyone,
> I have a "series2.raw" file together with it's header file "series2.mhd".
> The content of this ".mhd" file is as follows:
>
> ObjectType = Image
> NDims = 3
> BinaryData = True
> BinaryDataByteOrderMSB = False
> ElementSpacing = 0.449 0.449 0.600
> DimSize = 512 512 246
> ElementType = MET_USHORT
> ElementDataFile = series2.raw
>
> This raw file includes many image files as slices. I received this but did
> not know anything more about how many slices there are in this ".raw " file.
> I tried to read this ".raw" file by ITK 2.4.8 through both ".raw" file and
> ".mhd" file. I think I can read it. However, the problem is the work after
> that. I do not know how to extract the slices in this raw file correctly.
>
> 1. I used the code from "Examples/IO/DicomSeriesReadSeriesWrite.cxx" to
> write multiple slices. It did create 245 images but there is big distorsions
> in all images (slices). I checked on the internet and retrieved many
> anwsers. It is said that this was caused by the lack of orientation and etc.
> I found out that we can correct this problem by setting the
> metadatadictionaryArray through SetMetaDataDitionaryArray. But I do not know
> how to do it and how I can get the information of this
> metadatadictionaryarray. Is MetaDataDictionaryArray the list of all slice
> filenames? If I know how many slices there are in that raw file, CAN ITK
> help us to extract corectly?
>
> 2. Anyone know how to extract the slices from this ".raw" file correctly? I
> do not need to save it as DICOM slices. All I need is to extract all slices
> from this .raw file correctly so that I can have all slices as multi images
> in normal formats such as JPG, BMP or DICOM.
>
> Thanks in advance! Hope that I can have the answer for this problem which
> I've tried my best to solve but hopeless :( .
> Looking forward to your replies!
> Regards,
> Phuong Trinh.
>
>
> ________________________________
> Windows Live Hotmail: Your friends can get your Facebook updates, right from
> Hotmail®.


More information about the Insight-users mailing list