In [29]:
%pylab inline
import os.path as op
import io3d
import sed3


Populating the interactive namespace from numpy and matplotlib

In [25]:
output_path="e:data/medical/processed/porcine_liver_ct/"

In [52]:
pths = [
    [r"E:\data\medical\orig\ct_porcine_liver\P01\29-8-12-a\MakroCT\HEAD_01_HEADROUTINE_(ADULT)_20130218_133846_968000\HEAD_5_0_H31S_0004", "P01_MakroCT_HEAD_5_0_H31S_0004.mhd"],
    [r"E:\data\medical\orig\ct_porcine_liver\P01\29-8-12-a\MakroCT_po_rozrezani\HEAD_0_6_H20S_0003", "P01_MakroCT_po_rozrezani_HEAD_0_6_H20S_0003.mhd"],
    [r"E:\data\medical\orig\ct_porcine_liver\P01\29-8-12-a\MikroCT-nejhrubsi_rozliseni\DICOM_liver-1st-important_Macro_pixel-size53.0585um", "P01_a_MikroCT-nejhrubsi_rozliseni_DICOM_liver-1st-important_Macro_pixel-size53.0585um.mhd"],
    # [r"E:\data\medical\orig\ct_porcine_liver\P01\29-8-12-a\MikroCT-stredne_podrobne\Zdrojove_obrazky\Part1-130624_jatra2x1xX-A_1x_DICOM", "P01_a_MikroCT-stredne_podrobne_Part1-130624_jatra2x1xX-A_1x_DICOM.mhd"],
    # [r"E:\data\medical\orig\ct_porcine_liver\P01\29-8-12-a\Nejlep_rozl_vycistene\130624_jatra2x1xX-A_4x_DICOM_bestRECON-8bit_binning1", "P01_a_Nejlep_rozl_vycistene_130624_jatra2x1xX-A_4x_DICOM_bestRECON-8bit_binning1.mhd"],
    [r"E:\data\medical\orig\ct_porcine_liver\P01\29-8-12-b\Prase_1_druhe_vys", "P01_b_Prase_1_druhe_vys.mhd", 6],
    [r"E:\data\medical\orig\ct_porcine_liver\P01\c\DICOM-8bit-lowres_130926_liver-29-8-12-C_4x", "P01_c_DICOM-8bit-lowres_130926_liver-29-8-12-C_4x.mhd"],
    [r"E:\data\medical\orig\ct_porcine_liver\P01\c\DICOM-8bit-lowres_130926_liver-29-8-12-C_1x", "P01_c_DICOM-8bit-lowres_130926_liver-29-8-12-C_1x.mhd"],
    [r"E:\data\medical\orig\ct_porcine_liver\P01\c\DICOM-8bit_130926_liver-29-8-12-C_1x", "P01_c_DICOM-8bit_130926_liver-29-8-12-C_1x.mhd"],
    [r"E:\data\medical\orig\ct_porcine_liver\P01\29_8_12_d\DICOM-8bit-lowres_130926_liver-29-8-12-D_4x", "P01_d_DICOM-8bit-lowres_130926_liver-29-8-12-D_4x.mhd"],
    [r"E:\data\medical\orig\ct_porcine_liver\P12_P12\PRIVATE_00_KOROZIVNI_PREPARAT_(ADULT)_20151108_173623_929000\ABDOMENNATIVE_0_6_I26F_3_0005", "P12_ABDOMENNATIVE_0_6_I26F_3_0005.mhd"],
    [r"E:\data\medical\orig\ct_porcine_liver\P12_P12\Nejvyssi_rozliseni_DICOM_160222_P-12-1_4x", "P12_Nejvyssi_rozliseni_DICOM_160222_P-12-1_4x.mhd"] 

]

In [53]:
for fns in pths[:]:
    if len(fns) > 2:
        series_number = fns[2]
    else:
        series_number = None
    
    datap = io3d.read(fns[0], series_number=series_number)
    plt.figure(figsize=(10, 6))
    plt.suptitle(fns[1])
    slice_step = int(datap["data3d"].shape[0] / 5)
    sed3.show_slices(datap["data3d"], slice_step=slice_step)
    io3d.write(datap, op.join(output_path, fns[1]))


Unable to read dicom file dicomdir.pkl
File is missing 'DICM' marker. Use force=True to force reading
Problem with tag ImageComments
Depth of slices is not the same in beginning and end of the sequence
Depth of slices is not the same in beginning and end of the sequence
Unable to read dicom file dicomdir.pkl
File is missing 'DICM' marker. Use force=True to force reading
Depth of slices is not the same in beginning and end of the sequence
Problem with tag SeriesDescription, SeriesNumber: 6
Problem with tag ImageComments
Depth of slices is not the same in beginning and end of the sequence
Depth of slices is not the same in beginning and end of the sequence
Depth of slices is not the same in beginning and end of the sequence
Depth of slices is not the same in beginning and end of the sequence
Unable to read dicom file dicomdir.pkl
File is missing 'DICM' marker. Use force=True to force reading
Depth of slices is not the same in beginning and end of the sequence
Depth of slices is not the same in beginning and end of the sequence