Giter VIP home page Giter VIP logo

Comments (7)

dimitrisl avatar dimitrisl commented on September 26, 2024 1

Hello @thewtex ,
It seems to work now :) thanks a lot!

from itkanisotropicdiffusionlbr.

thewtex avatar thewtex commented on September 26, 2024 1

This

instance = itk.CoherenceEnhancingDiffusionImageFilter[itk.Image[itk.F,2]].New(rescaled_image)

Needs to be

instance = itk.CoherenceEnhancingDiffusionImageFilter[itk.Image[itk.F,2]].New(rescaled_image)
instance.Update()

or the filter is not executed, and the output is not populated. Alternatively, use ITK 5 Pythonic syntax, which determines the required type, runs .Update() and returns the filter's output:

smoothed_image = itk.coherence_enhancing_diffusion_image_filter(rescaled_image)

Also, this does not work:

instance = itk.GetArrayViewFromImage(instance)

because it is generate a view on an image instance (i.e. a look into the image's pixel buffer memory), but then it is overwriting the image instance. The view will not be pointing to anything that exists, which will cause a crash. Instead, use:

instance = itk.GetArrayFromImage(instance)

or the nicer:

instance = itk.array_from_image(instance)

from itkanisotropicdiffusionlbr.

dimitrisl avatar dimitrisl commented on September 26, 2024 1

itk.array_from_image(instance)

@thewtex Awesome!! Thank you very much, it really saved me a lot of time.
Thanks again for the fast and helpful answers!

from itkanisotropicdiffusionlbr.

thewtex avatar thewtex commented on September 26, 2024

Hello Dimitris @dimitrisl ,

A new version, 1.0.2, built against itk-5.0.0.post1 has been uploaded to PyPI, which should fix your segmentation fault issue.

Please try:

python -m pip install --upgrade itk-anisotropicdiffusionlbr

and let us know how it goes.

from itkanisotropicdiffusionlbr.

dimitrisl avatar dimitrisl commented on September 26, 2024

hello again @thewtex

it seems that another issue occured.
In [5]: instance = itk.CoherenceEnhancingDiffusionImageFilter(rescaled_image)
Segmentation fault (core dumped)

from itkanisotropicdiffusionlbr.

thewtex avatar thewtex commented on September 26, 2024

@dimitrisl could a SSCCE be shared?

from itkanisotropicdiffusionlbr.

dimitrisl avatar dimitrisl commented on September 26, 2024

@thewtex

import matplotlib.pyplot as plt
import numpy as np
import itk

image = np.random.randn(1517, 1501).astype("float32")
rescaled_image = (image - np.min(image))/np.ptp(image)
rescaled_image = itk.GetImageViewFromArray(rescaled_image)
instance = itk.CoherenceEnhancingDiffusionImageFilter[itk.Image[itk.F,2]].New(rescaled_image)

instance = itk.GetArrayViewFromImage(instance)
plt.imshow(instance) # essentially it breaks on this point here..but this behaviour is not consistent
plt.show()

from itkanisotropicdiffusionlbr.

Related Issues (4)

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.