Git Product home page Git Product logo

Comments (9)

zivy avatar zivy commented on June 11, 2024 5

Hello @Ivanka07,

That is strange. The conversion to list should work with the versions you are using. On OSX, Python 3.8.5, SimpleITK 2.1.0 the following works, please try:

import SimpleITK as sitk
import numpy as np

rif = sitk.ResampleImageFilter()
rif.SetSize(np.array([1, 2, 3], dtype='int').tolist())

from simpleitk.

Grieverheart avatar Grieverheart commented on June 11, 2024 1

4 years later, I stumbled upon this issue myself. Is this going to get fixed?

from simpleitk.

IvannaKramer avatar IvannaKramer commented on June 11, 2024 1

@Grieverheart have you found a solution/workarround for this issue? I am using Python3.8 and SimpleITK 2.1.0 and above proposed solutions don't work for me...

from simpleitk.

zhilothebest avatar zhilothebest commented on June 11, 2024 1

using tolist() does not work for me in my case.

from simpleitk.

blowekamp avatar blowekamp commented on June 11, 2024

Thank you for reporting the issue.

@zivy Have you encountered this issue?

from simpleitk.

zivy avatar zivy commented on June 11, 2024

Confirmed the issue. I have never tried it with numpy arrays, as I either use tuple or list notation for these operations (these work in Python3).

@haarburger just out of curiosity, what was the motivation for using a numpy array for specifying size vs. the more concise list or tuple notation?

from simpleitk.

haarburger avatar haarburger commented on June 11, 2024

@zivy Using numpy arrays was not my decision. It was implemented like that in pyradiomics and as a pyradiomics user I stumbled upon this.

from simpleitk.

blowekamp avatar blowekamp commented on June 11, 2024

There looks like there is a related SWIG issue open: swig/swig#888
We will also look into finding a work around in SimpleITK too.

from simpleitk.

zivy avatar zivy commented on June 11, 2024

Hello @zhilothebest,

Please provide a minimal working example showing that the usage of tolist() does not work. I tried resampling with a numpy array converted via the tolist function and it does work for me.

Possibly specify the Python version and OS you are using.

from simpleitk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.