How to import a DICOM file and create the corresponding range file?


I try to simulate the photon scattering effect on CT. I convert the CT into .mdh/.raw format, then I came across the error when I ran the script: GGEMS GGEMSVoxelizedSolid::ConvertImageToLabel Errors(s) in the range data file!

Any clues how to fix it ?



It’s not easy to know what problem you are having. Have you checked that your DICOM file is converted to MHD/RAW properly ? If your MHD file opens normally, check that all the materials are present in your range file that you created, maybe some are missing. Last point, check that the tags in the MHD file header are the same tags as the MHD files in the examples.

Kind regards

Hi Didier,

Thanks for your kind reply, how should I know what kind of materials should I put in the range file?
I found the materials in the range file in the example just air and water, in my case, the mhd file is
from a patient CT, then what kind of materials should I put in my range file?


Hi Yingpeng,
With a patient CT it takes longer to create your range data file. I don’t have an automatic conversion tool. If your data is in Hounsfield you have to do the conversion yourself, for example

-1050 -950 Air_0
-950 -852.884 Lung_1
-852.884 -755.769 Lung_2
-755.769 -658.653 Lung_3
-658.653 -561.538 Lung_4
-561.538 -464.422 Lung_5
-464.422 -367.306 Lung_6
-367.306 -270.191 Lung_7
-270.191 -173.075 Lung_8
-173.075 -120 Lung_9
-120 -82 AT_AG_SI1_10
-82 -52 AT_AG_SI2_11
-52 -22 AT_AG_SI3_12
-22 8 AT_AG_SI4_13
8 19 AT_AG_SI5_14
19 80 SoftTissus_15
80 120 ConnectiveTissue_16
120 200 Marrow_Bone01_17
200 300 Marrow_Bone02_18
300 400 Marrow_Bone03_19
400 500 Marrow_Bone04_20
500 600 Marrow_Bone05_21
600 700 Marrow_Bone06_22
700 800 Marrow_Bone07_23
800 900 Marrow_Bone08_24
900 1000 Marrow_Bone09_25
1000 1100 Marrow_Bone10_26
1100 1200 Marrow_Bone11_27
1200 1300 Marrow_Bone12_28
1300 1400 Marrow_Bone13_29
1400 1500 Marrow_Bone14_30
1500 1640 Marrow_Bone15_31
1640 1807.5 AmalgamTooth_32
1807.5 1975.01 AmalgamTooth_33
1975.01 2142.51 AmalgamTooth_34
2142.51 2300 AmalgamTooth_35
2300 2467.5 MetallImplants_36
2467.5 2635.01 MetallImplants_37
2635.01 2802.51 MetallImplants_38
2802.51 2970.02 MetallImplants_39
2970.02 4000 MetallImplants_40

You can take inspiration from previous data. And check that the materials are in the “materials.txt” file

Kind regards

Hi Diddier,

According to your instruction, I tried a couple of formats in range file as followings:

-1050 -950 Air_0
-950 -852.884 Lung_1
-852.884 -755.769 Lung_2

0 0 Air_0
1 1 Lung_1
2 2 Lung_2

but it still complain with the same error massage when I run example with mhd file from CT, following is the error massage:
GGEMS GGEMSVoxelizedSolid::ConvertImageToLabel Errors(s) in the range data file!!!

I guess the range file should be the same for all runs if the mhd data is derived from CT dicom file. Can you do a test to figure out the correct range file for the run with dicom mhd file?