Giter Club home page Giter Club logo

gibbs-removal's People

Contributors

rafaelnh avatar solleo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gibbs-removal's Issues

Runtime error

Hi,

Thanks for the codes. But there seems to be an issue with indexing. I tired to run GIBBSremoval_in_DWI.ipynb and in cell#2, I've got this error:
`

Correct gibbs

image_cor, tv = gibbs_removal_2d(image_gibbs)

TypeError Traceback (most recent call last)
in ()
28
29 # Correct gibbs
---> 30 image_cor, tv = gibbs_removal_2d(image_gibbs)
31
32 # plot

/mysystem/gibbs-removal-master/gibbs_removal.py in gibbs_removal_2d(image, fn, nn, G0, G1)
270 G0, G1 = gibbs_removal_2d_weigthing_functions(image.shape)
271
--> 272 img_c1, tv_c1 = gibbs_removal_1d(image, a=1, fn=fn, nn=nn)
273 img_c0, tv_c0 = gibbs_removal_1d(image, a=0, fn=fn, nn=nn)
274

/mysystem/gibbs-removal-master/gibbs_removal.py in gibbs_removal_1d(x, a, fn, nn)
145
146 # TV for shift zero (baseline)
--> 147 TVR, TVL = image_tv(x, fn=fn, nn=nn, a=a)
148 TVP = np.minimum(TVR, TVL)
149 TVN = TVP.copy()

/mysystem/gibbs-removal-master/gibbs_removal.py in image_tv(x, fn, nn, a)
95 NTV = np.absolute(xs[:, (nn+fn):(-nn-fn)] - xs[:, (nn+fn-1):(-nn-fn-1)])
96 for n in np.linspace(fn+1, nn-2, num=nn-2):
---> 97 PTV = PTV + np.absolute(xs[:, (nn+fn+n):(-nn-fn+n)] -
98 xs[:, (nn+fn+n+1):(-nn-fn+n+1)])
99 NTV = NTV + np.absolute(xs[:, (nn+fn-n):(-nn-fn-n)] - \

TypeError: slice indices must be integers or None or have an index method`

This was caused by that the way you genereated the iteration list for n using np.linspace, of which the output is a float ndarray, thus n is also a float, but for indexing it must be an integer. So just
for n in np.linspace(fn+1, nn-2, num=nn-2, dtype=int):
fixed the issue. I'm not familiar with python, so I guess this might be something to do with the python2 and python3? I used anaconda-packaged python3, so this might have return an integer ndarray without specifying dtype?

not get the right result

Hi. I tried your code version, and somehow, it got strange results.
here is the input:

image

and here is the output
image

as I kept everything as default. the size of the image is 192x192x110.
Let me know if I missed anything. Thank you.

Could not broadcast input array

Thanks for implementing this in python, I'm trying some tests and getting a failure:

> import gibbs_removal
> import SimpleITK as sitk
> image = sitk.ReadImage("../unring/fsl/brain1_t2_1.nii")
> imagedata = sitk.GetArrayFromImage(image)
> print(imagedata.shape)
(555, 487, 548)
>
dering = gibbs_removal.gibbs_removal(imagedata)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-14-f26ec4e4264c> in <module>
----> 1 dering = gibbs_removal.gibbs_removal(imagedata)

/scratch/gibbs-removal/gibbs_removal.py in gibbs_removal(vol, slice_axis, n_points)
    317     # Produce weigthing functions for 2D gibbs removal
    318     shap = vol.shape
--> 319     G0, G1 = _weights(shap[:2])
    320 
    321     # Run gibbs removal of 2D images

/scratch/gibbs-removal/gibbs_removal.py in _weights(shape)
    187     cosk0 = 1.0 + np.cos(K0)
    188     cosk1 = 1.0 + np.cos(K1)
--> 189     G1[1:-1, 1:-1] = cosk0 / (cosk0+cosk1)
    190     G0[1:-1, 1:-1] = cosk1 / (cosk0+cosk1)
    191 

ValueError: could not broadcast input array from shape (553,553) into shape (553,485)
> conda list | grep numpy
numpy                     1.16.2           py37h7e9f1db_0  
numpy-base                1.16.2           py37hde5b4d6_0  
numpydoc                  0.8.0                    py37_0

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.