Skip to content

MR Dicom writer fails  #1128

@johannesmayer

Description

@johannesmayer

The following error crashes the gadgetron server when trying to write an MR reconstruction to DICOM with the script below:

... some Gadgetron stream output...

07-28 14:18:04.857 INFO [GadgetStreamController.cpp:313]   Gadget class: DicomFinishGadget
07-28 14:18:04.857 INFO [GadgetStreamController.cpp:328]   Gadget parameters: 0
07-28 14:18:04.857 INFO [GadgetStreamController.cpp:356] Gadget Stream configured
terminate called after throwing an instance of 'std::runtime_error'
  what():  Unable to load ISMRMRD Meta XML document
Aborted (core dumped)

The script succeeds at writing dicom files for idx_file_to_run = 0,1 (where also the attribute XML file is generated) and fails for idx_file_to_run = 2,3

import sirf.Gadgetron as pMR
import numpy as np 
import os

def normalise_image_data(img):

    img = img.abs()

    img_max = np.max(img.as_array())
    img_min = np.min(img.as_array())

    img = 2**16 * (img - img_min)/(img_max-img_min)

    return img

sirf_install_path = str(os.getenv("SIRF_INSTALL_PATH"))
fpath_in = sirf_install_path + "/share/SIRF-3.3/data/examples/MR/" 

fnames_in = ["simulated_MR_2D_cartesian.h5",
"grappa2_1rep.h5",
"simulated_MR_2D_cartesian_Grappa2.h5",
"grappa2_6rep.h5"]

fname_out = "/media/sf_CCPPETMR/tmp_recon.dcm" # or whatever path you have write access to

idx_file_to_run = 0 # or 1, 2, 3
ad = pMR.AcquisitionData(fpath_in + fnames_in[idx_file_to_run])
ad = pMR.preprocess_acquisition_data(ad)
ad.sort()

recon = pMR.CartesianGRAPPAReconstructor()
recon.set_input(ad)

recon.process()
id = recon.get_output()
id = normalise_image_data(id)

id.write(fname_out)

I am on a VM at origin/master and build against ISMRMRD/v1.7.0 and Gadgetron is also built against this ISMRMRD version at the commit b6191eaaa72ccca6c6a5fe4c0fa3319694f512ab.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions