gift-surg / NiftyMIC

NiftyMIC is a research-focused toolkit for motion correction and volumetric image reconstruction of 2D ultra-fast MRI.
BSD 3-Clause "New" or "Revised" License
133 stars 32 forks source link

Niftymic killed with Docker image #25

Open yuezhang9842 opened 2 years ago

yuezhang9842 commented 2 years ago

Dear all,

Thank you for this great package. When I run the niftymic_reconstruct_volume, the program is always “Killed”. I have set the memory to the maximum memory(16G + 4G swap), but still not enough. When the memory usage of container reaches 16G, the program will be "killed". I wonder how can I solve this problem?

`# niftymic_reconstruct_volume \ --filenames /www/cor/T2_bias.nii.gz /www/sag/T2_bias.nii.gz /www/tra/T2_bias.nii.gz \ --filenames-masks /www/cor/T2_label.nii.gz /www/sag/T2_label.nii.gz /www/tra/T2_label.nii.gz \ --output /www/srr.nii.gz \


Configuration: --- alpha: 0.015 --- alpha_first: 0.2 --- bias_field_correction: 0 --- boundary_stacks: 10 10 0 --- config: None --- dilation_radius: 3 --- extra_frame_target: 10 --- filenames: /www/cor/T2_bias.nii.gz /www/sag/T2_bias.nii.gz /www/tra/T2_bias.nii.gz --- filenames_masks: /www/cor/T2_label.nii.gz /www/sag/T2_label.nii.gz /www/tra/T2_label.nii.gz --- intensity_correction: 1 --- interleave: 3 --- isotropic_resolution: 1 --- iter_max: 10 --- iter_max_first: 5 --- iterations: 15 --- log_config: 1 --- metric: Correlation --- metric_radius: 10 --- multiresolution: 0 --- outlier_rejection: 1 --- output: /www/srr.nii.gz --- reconstruction_type: TK1L2 --- reference: None --- reference_mask: None --- s2v_hierarchical: False --- sda: False --- search_angle: 45 --- shrink_factors: 3 2 1 --- sigma: 1 --- slice_thicknesses: None --- smoothing_sigmas: 1.5 1 0 --- subfolder_motion_correction: motion_correction --- suffix_mask: _mask --- target_stack: None --- threshold: 0.8 --- threshold_first: 0.5 --- transforms_history: 0 --- two_step_cycles: 3 --- use_masks_srr: 0 --- v2v_method: RegAladin --- v2v_robust: False --- verbose: 0 --- viewer: itksnap --- write_motion_correction: 1

NiftyMIC version: 0.9


--- File written to '/www/config_reconstruct_volume_20220604-094944.json'.


Read Data --- 3 input stacks read for further processing


Data Preprocessing --- 3 stacks were loaded for data preprocessing --- Crop stacks to their masks


Volume-to-Volume Registration --- Volume-to-Volume Registration -- Stack 1/3 220604-09:50:09,211 nipype.interface WARNING: version_from_command member of CommandLine was Deprecated in nipype-1.0.0 and deleted in 1.1.0 220604-09:50:09,343 nipype.interface WARNING: version_from_command member of CommandLine was Deprecated in nipype-1.0.0 and deleted in 1.1.0 --- Volume-to-Volume Registration -- Stack 2/3 220604-09:50:47,548 nipype.interface WARNING: version_from_command member of CommandLine was Deprecated in nipype-1.0.0 and deleted in 1.1.0 220604-09:50:47,655 nipype.interface WARNING: version_from_command member of CommandLine was Deprecated in nipype-1.0.0 and deleted in 1.1.0 --- Volume-to-Volume Registration -- Stack 3/3 220604-09:51:32,424 nipype.interface WARNING: version_from_command member of CommandLine was Deprecated in nipype-1.0.0 and deleted in 1.1.0 220604-09:51:32,529 nipype.interface WARNING: version_from_command member of CommandLine was Deprecated in nipype-1.0.0 and deleted in 1.1.0


Intensity Correction --- Stack 1 (T2_bias): Reference image. Skipped. --- Stack 2 (T2_bias): Intensity Correction ... done (c1 = 0.908708) --- Stack 3 (T2_bias): Intensity Correction ... done (c1 = 0.949986)


Reconstruction Space Generation --- Isotropic reconstruction space with 1 mm resolution is created --- Isotropic reconstruction space is centered around joint stack masks.


First Estimate of HR Volume

SDA Approximation Image --- Chosen SDA approach: Shepard-YVV --- Smoothing parameter sigma = [1. 1. 1.] --- Stack 1/3 --- Stack 2/3 --- Stack 3/3 --- Required computational time: 0:00:19.953441

SDA Approximation Image Mask --- Chosen SDA approach: Shepard-YVV --- Smoothing parameter sigma = [1. 1. 1.] --- Stack 1/3 --- Stack 2/3 --- Stack 3/3 --- Required computational time: 0:00:04.960164


Two-step S2V-Registration and SRR Reconstruction


Slice-to-Volume Registration --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 1/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 2/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 3/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 4/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 5/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 6/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 7/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 8/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 9/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 10/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 11/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 12/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 13/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 14/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 15/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 16/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 17/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 18/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 1/3 (T2_bias) -- Slice 19/19 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 1/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 2/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 3/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 4/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 5/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 6/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 7/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 8/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 9/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 10/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 11/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 12/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 13/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 14/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 15/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 16/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 2/3 (T2_bias) -- Slice 17/17 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 3/3 (T2_bias) -- Slice 1/21 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 3/3 (T2_bias) -- Slice 2/21 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 3/3 (T2_bias) -- Slice 3/21 --- Cycle 1/3: Slice-to-Volume Registration -- Stack 3/3 (T2_bias) -- Slice 4/21 Killed `

renbem commented 2 years ago

Hi, if it's killed because of not enough memory, there's not much I can do, unfortunately. Besides having more RAM available, you could create tighter masks or lower the resolution, e.g. set --isotropic-resolution to 1.5 or 2 mm. Both will reduce the memory requirements. The latter of course will reduce image quality but could be a good first step to check that you can get successful recontructions

renbem commented 2 years ago

One thing though, Docker may have less memory available than what you have on your system. Perhaps worth checking as well.

yuezhang9842 commented 2 years ago

Hello. The “killed” problem has been solved, it seems that the ARM64 system used by Apple M1 is not suitable for docker. So I switched to Windows. However I also wonder if I need to download the images of ITK_Niftymic and Simplereg to use Niftymic?

yuezhang9842 commented 2 years ago

Meanwhile, I‘m having troubles with “Transformation to Template Space”. It seems that the registration was not successful. Here is my code:

niftymic_register_image \
--fixed ./NiftyMIC/data/templates/STA33.nii.gz \
--fixed-mask ./NiftyMIC/data/templates/STA33_mask.nii.gz \
--moving /www1/results/results-0.01-t/srr.nii.gz \
--moving-mask /www1/results/results-0.01-t/srr_mask.nii.gz \
--dir-input-mc /www1/results/results-0.01-t/motion_correction \
--output /www1/results/results-0.01-t/registration-transform.txt
niftymic_reconstruct_volume_from_slices \
--filenames /www1/cor/T2_bias.nii.gz /www1/sag/T2_bias.nii.gz /www1/tra/T2_bias.nii.gz \
--filenames-masks /www1/cor/T2_label.nii.gz /www1/sag/T2_label.nii.gz /www1/tra/T2_label.nii.gz \
--output /www1/results/srr-0.01-t-mc.nii.gz \
--reconstruction-space ./NiftyMIC/data/templates/STA33.nii.gz \
--reconstruction-type TK1L2 \
--alpha 0.01
***************************************************************************************************
*** Configuration: ***
--- config: None
--- dir_input_mc: /www1/results/results-0.01-t/motion_correction
--- fixed: ./NiftyMIC/data/templates/STA33.nii.gz
--- fixed_mask: ./NiftyMIC/data/templates/STA33_mask.nii.gz
--- init_pca: False
--- initial_transform: None
--- log_config: 1
--- method: RegAladin
--- moving: /www1/results/results-0.01-t/srr.nii.gz
--- moving_mask: /www1/results/results-0.01-t/srr_mask.nii.gz
--- output: /www1/results/results-0.01-t/registration-transform.txt
--- verbose: 0

NiftyMIC version: 0.9
***************************************************************************************************

--- File written to '/www1/results/results-0.01-t/config_register_image_20220619-153337.json'.

***************************************************************************************************
*** Read Data ***

***************************************************************************************************
*** Registration ***
--- Run Registration (RegAladin) ... done
--- Registration transformation written to '/www1/results/results-0.01-t/registration-transform.txt'

***************************************************************************************************
*** Update Motion-Correction Transformations ***
--- 0 transformations written to '/www1/results/results-0.01-t/motion_correction'

***************************************************************************************************
*** Summary ***
register_image | Computational Time: 0:00:15.605149

image

And here is the results of SRR, But I don‘t know what is the problem causing such strange results. Hope to get your help!!!

wangyunai commented 1 year ago

I met similar problem after SSRI. Did you solve this issue ? Thanks.