Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH]: Memory issue during layer creation #8

Open
1 task done
marcobarilari opened this issue Apr 21, 2022 · 0 comments
Open
1 task done

[ENH]: Memory issue during layer creation #8

marcobarilari opened this issue Apr 21, 2022 · 0 comments

Comments

@marcobarilari
Copy link
Collaborator

marcobarilari commented Apr 21, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant