Skip to content

[BUG] #90

@acsenrafilho

Description

@acsenrafilho

Describe the bug
There is a problem to the logic of _Mapping (CBF/MultiTE, etc), due to using the m0 path as reference to adjust the output maps headers.

Code part:

        cbf_map_image = ImageIO(self._asl_data('m0').get_image_path())
        cbf_map_image.update_image_data(self._cbf_map)

        cbf_map_norm_image = ImageIO(self._asl_data('m0').get_image_path())
        cbf_map_norm_image.update_image_data(self._cbf_map * (60 * 60 * 1000))

        att_map_image = ImageIO(self._asl_data('m0').get_image_path())
        att_map_image.update_image_data(self._att_map)

To Reproduce
Steps to reproduce the behavior:

  1. Create an object for the recosntruction class (eg: MultiTEASLMapping)
  2. Input in the m0 input parameter a numpy array instead of a file path

In this way, the code above will not find a path and them broke the reconstruction.

Expected behavior
The output maps should be created normally, without the need for the m0 header.
Try to find an alternative to it.

Additional context
This bug was found by trying to execute the following unit test:

def test_multite_asl_object_create_map_success_using_average_m0_option():
    base_m0 = ImageIO(M0).get_as_numpy()
    m04d = np.stack([base_m0 for _ in range(3)], axis=0)
    asldata4d = ASLData(
        pcasl=PCASL_MTE,
        m0=m04d,
        ld_values=[100.0, 100.0, 150.0, 150.0, 400.0, 800.0, 1800.0],
        pld_values=[170.0, 270.0, 370.0, 520.0, 670.0, 1070.0, 1870.0],
        te_values=[13.56, 67.82, 122.08, 176.33, 230.59, 284.84, 339.100, 393.36],
        average_m0=True,
    )
    mte = MultiTE_ASLMapping(asldata4d)
    mask = ImageIO(M0_BRAIN_MASK)

    mte.set_brain_mask(mask)

    output = mte.create_map()

    assert output['cbf'].get_as_numpy().shape == base_m0.shape
    assert output['att'].get_as_numpy().shape == base_m0.shape
    assert output['t1blgm'].get_as_numpy().shape == base_m0.shape

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions