[Python] module 'ants' has no attribute 'from_numpy'

Discussão em 'Python' iniciado por Stack, Março 21, 2025.

  1. Stack

    Stack Membro Participativo

    I am working in a jupyter notebook, and used pip to install ANTsPy:

    pip install antspyx


    However, using the function from_numpy throws an error:

    import ants

    Im2Use=Im[0,:,:,:]
    fixed, moving, mytx=reg(Im2Use, t_rz)
    fwdtransforms=mytx['fwdtransforms']
    fixed_ants= ants.from_numpy(Im2Use.astype(float))
    moving_ants= ants.from_numpy(t_rz.astype(float))
    mywarpedimage=ants.apply_transforms( fixed=fixed_ants, moving=moving_ants,transformlist=fwdtransforms)

    AttributeError: module 'ants' has no attribute 'from_numpy'


    How can I solve this? I've also tried importing ants using import ants.from_numpy, but that did not work.

    Continue reading...

Compartilhe esta Página