Skip to content

[ENH]: Memory issue during layer creation #8

@marcobarilari

Description

@marcobarilari

Is there an existing issue for this?

  • I have searched the existing issues

New feature

With upsampled data, the layering of one subject is "killed" after cruise step of first hemisphere due to memory (RAM) issue. Working with a computer with 64GB of RAM.

Not sure but I suspect that the problem is that the code keeps the output of the below functions dave in the output variable hogging the memory.

cortex = nighres.brain.extract_brain_region(
   segmentation=segmentation_img[0],
   levelset_boundary=levelset_boundary_img[0],
   maximum_membership=max_membership_img[0],
   maximum_label=max_label_img[0],
   extracted_region=roi,
   save_data=True,
   file_name=f"{output_filename}_hemi-{label}",
   output_dir=output_dir,
)

cruise = nighres.cortex.cruise_cortex_extraction(
   init_image=cortex["inside_mask"],
   wm_image=cortex["inside_proba"],
   gm_image=cortex["region_proba"],
   csf_image=cortex["background_proba"],
   normalize_probabilities=True,
   save_data=True,
   file_name=f"{output_filename}_hemi-{label}",
   output_dir=output_dir,
)

My possible solution, if this is the problem, would be to refactor the code and after eg the first step `cortex = nighres.brain.extract_brain_region` clear `cortex` and make `cruise = nighres.cortex.cruise_cortex_extraction` load the nii saved output of the previous step.

Though, the saved files from these two steps do not wait more than ~4GB

Unclear documentation

No response

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