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

Failed to allocate memory for image #934

Closed
qiang-zhang-neu opened this issue Jan 15, 2020 · 7 comments
Closed

Failed to allocate memory for image #934

qiang-zhang-neu opened this issue Jan 15, 2020 · 7 comments

Comments

@qiang-zhang-neu
Copy link

Failed to allocate memory for image to denoise an image:

DenoiseImage -d 3 -v 1 -i $expirationPreprocessed -o $expirationPreprocessed

the size of image is 120 M, the memory of my computer is 32G. Does the DenoiseImage cause so much memory?

@ntustison
Copy link
Member

I wouldn't think 120 MB should be a problem. Have you tried your call on a smaller image?

@cookpa
Copy link
Member

cookpa commented Jan 15, 2020

What are the actual dimensions of the image? Use PrintHeader $expirationPreprocessed to tell. A compressed image could be much smaller on disk than it is in memory.

@qiang-zhang-neu
Copy link
Author

qiang-zhang-neu commented Jan 16, 2020

I wouldn't think 120 MB should be a problem. Have you tried your call on a smaller image?

Yes, it works on a 60 MB image, whose size is about [200, 200, 300]

@qiang-zhang-neu
Copy link
Author

qiang-zhang-neu commented Jan 16, 2020

What are the actual dimensions of the image? Use PrintHeader $expirationPreprocessed to tell. A compressed image could be much smaller on disk than it is in memory.

The image size is [512, 512, 348], and the details are shown as following:


Preprocessing:  Denoise.
 Spacing [1, 1, 1]
 Origin [0, 0, 0]
 Direction
1 0 0
0 1 0
0 0 1

 Size : 348 512  512

  Image Dimensions   : [348, 512, 512]
  Bounding Box       : {[0 0 0], [348 512 512]}
  Voxel Spacing      : [1, 1, 1]
  Intensity Range    : [-1024, 2907]
  Mean Intensity     : -659.309
  Direction Cos Mtx. :
1 0 0
0 1 0
0 0 1

  Voxel->RAS x-form  :
  Image Metadata:
    bitpix = 32
    cal_max = 0
    cal_min = 0
    datatype = 16
    dim[0] = 3
    dim[1] = 348
    dim[2] = 512
    dim[3] = 512
    dim[4] = 1
    dim[5] = 1
    dim[6] = 1
    dim[7] = 1
    dim_info = 0
    intent_code = 0
    intent_p1 = 0
    intent_p2 = 0
    intent_p3 = 0
    nifti_type = 1
    pixdim[0] = 0
    pixdim[1] = 1
    pixdim[2] = 1
    pixdim[3] = 1
    pixdim[4] = 0
    pixdim[5] = 0
    pixdim[6] = 0
    pixdim[7] = 0
    qform_code = 1
    qform_code_name = NIFTI_XFORM_SCANNER_ANAT
    qoffset_x = -0
    qoffset_y = -0
    qoffset_z = 0
    quatern_b = 0
    quatern_c = 0
    quatern_d = 1
    scl_inter = 0
    scl_slope = 1
    sform_code = 0
    sform_code_name = NIFTI_XFORM_UNKNOWN
    slice_code = 0
    slice_duration = 0
    slice_end = 0
    slice_start = 0
    srow_x = 0 0 0 0
    srow_y = 0 0 0 0
    srow_z = 0 0 0 0
    toffset = 0
    vox_offset = 352
    xyzt_units = 2

Running for 3-dimensional images.

Exception caught:
itk::MemoryAllocationError (0094F668)
Location: "unknown"
File: d:\program files\itk\insighttoolkit-5.0.1\modules\core\common\include\itkImportImageContainer.hxx
Line: 199
Description: Failed to allocate memory for image.

@qiang-zhang-neu
Copy link
Author

qiang-zhang-neu commented Jan 19, 2020

@ntustison when I down-resample the image to [256, 512, 348], the code is OK.
But the bug "Failed to allocate memory for image" will be reported when the size of image is [512, 512, 348]. I'am quite confused why a 120M data would require much large memory?

@ntustison
Copy link
Member

I'd be more than willing to look at your data to see if there's anything unusual but I suspect this is a system-specific issue.

@qiang-zhang-neu
Copy link
Author

I'd be more than willing to look at your data to see if there's anything unusual but I suspect this is a system-specific issue.

I have uploaded my data to github.

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

3 participants