Skip to content

Developer question: why so many clones? #811

Description

@cookpa

This came up because of slow performance in ants.resample_image for large images

Lots of copies of the big image happening

if image.components == 1:
inimage = image.clone('float')
outimage = image.clone('float')
rsampar = 'x'.join([str(rp) for rp in resample_params])
args = [image.dimension, inimage, outimage, rsampar, int(use_voxels), interp_type]
processed_args = process_arguments(args)
libfn = get_lib_fn('ResampleImage')
libfn(processed_args)
outimage = outimage.clone(image.pixeltype)
return outimage

Originally posted by @cookpa in #810

Do all these clones need to happen? Would it be possible to initialize a dummy image and pass that pointer to libfn?

Metadata

Metadata

Assignees

No one assigned

    Labels

    codeCode best practices, style, lintingquestion

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions