ecaruyer / phantomas Goto Github PK
View Code? Open in Web Editor NEWCreate realistic digital phantoms in diffusion MRI.
License: Other
Create realistic digital phantoms in diffusion MRI.
License: Other
Hi @ecaruyer, is it possible with/without modifications of phantomas to simulate the dwi signal from dyads as generated by Bedpost? This means: we have voxel-wise information of the orientations of up-to 3 fibers, and then the corresponding volume of each.
There is a typo in scripts/phantomas_dwis which prevents script from reading volume_fraction entries in the .json file
line 117
volume_fraction = region_params.get("volume3_fraction", 1.0)
On the left is the old version of the tracking mask for the the isbi phantom and on the right the new one (made using the phantomas_rois scripts, this is fibers.nii). It seems like the partial volume spheres are pure csf, and are not included in the tracking mask as shown on the right, while they seem to be included in the old version.
This reduces some bundles to 1 or 2 voxels of width, while the old version had more voxel and would allow passing through the spheres.
After downloading and installing phantomas, I get the following when I run "phantomas_dwis -h"
Traceback (most recent call last):
File "/usr/local/bin/phantomas_dwis", line 19, in
from phantomas.mr_simul.fod
File "/media/hda6/Experimenten/phantomas/phantomas/mr_simul/fod.py", line 7, in
from .fast_volume_fraction import *
ImportError: No module named fast_volume_fraction
I've tried several things and searched a bit and it seems that the cython-module fast_volume_fraction doesn't get imported correctly. However it did compile:
steven@SterlingArcher /media/hda6/Experimenten/phantomas/build/lib.linux-x86_64-2.7/phantomas/mr_simul $ ls
fast_volume_fraction fast_volume_fraction.so fod.py image_formation.py init.py partial_volume.py spherical_21_design.txt synthetic.py
steven@SterlingArcher /media/hda6/Experimenten/phantomas/build/lib.linux-x86_64-2.7/phantomas/mr_simul $ ls fast_volume_fraction
init.py pyx.so
steven@SterlingArcher /media/hda6/Experimenten/phantomas/build/lib.linux-x86_64-2.7/phantomas/mr_simul $
Python is novel to me, so I'm not sure how to solve it. Do you have a solution for this?
I get this error running the script (phantomas_view 20crossing.txt):
Reading geometry description...
Traceback (most recent call last):
File "/home/ggirard/research/phantomas/scripts/phantomas_view", line 64, in
view = ViewFiber(fiber, ren, color=color.next(), label=fiber_name)
File "/home/ggirard/research/phantomas/phantomas/visu/views.py", line 14, in init
self.init_draw(fiber, ren, **kwargs)
File "/home/ggirard/research/phantomas/phantomas/visu/views.py", line 42, in init_draw
stream_tube.SetInputData(poly_data)
AttributeError: SetInputData
I randomly checkout the code from PR4, and phantomas_view worked well in that previous state.
Seems like white matter attenuation (as well as diffusion-weighted images) have negative values. Thanks @samuelstjean for letting me know!
I think Samuel St-Jean has had this issue in the past. It seems that for some configuration of python environment running the phantomas_dwi generates "empty" diffusion-weighted images. The geometry and the size of the file is ok, the b0 image is ok also, but all diffusion-weighted images have the same value of 22 within the mask.
I have no idea how this happens. Sam and I have this issue whereas Gab Girard and Mic Paquette don't...
It seems like they changed something in one of their function definition, as I get
Reading geometry description...
Traceback (most recent call last):
File "/home/samuel/.local/bin/phantomas_dwis", line 6, in <module>
exec(compile(open(__file__).read(), __file__, 'exec'))
File "/home/samuel/git/phantomas/scripts/phantomas_dwis", line 98, in <module>
f = FiberSource(control_points, tangents=tangents_mode)
File "/home/samuel/git/phantomas/phantomas/geometry/fiber.py", line 42, in __init__
self._create_from_control_points(control_points, tangents, scale)
File "/home/samuel/git/phantomas/phantomas/geometry/fiber.py", line 94, in _create_from_control_points
scale * np.vstack((control_points[:, 0], derivatives[:, 0])).T)
File "/home/samuel/.local/lib/python2.7/site-packages/scipy/interpolate/interpolate.py", line 643, in __init__
raise ValueError("%s must be between 0 and %s" % (axis, c.ndim-1))
ValueError: 0 must be between 0 and 0
Same thing happen in 0.18.1 for various bundled valid txt control files with phantomas.
Downgrading to 0.17 works perfectly well and does not raise any error message though, so it can be worked around easily.
The translation part of the affine matrix seems wrong, or at least does not place the center of the volume to position (0, 0, 0). (Thanks @jchoude for letting me know)
Create mask of white matter, as well as a mask for each bundle.
A small proposed enhancement, I was running the phantomas_dwis script but mistyped the bval filename. So the script compted everything and did it's stuff, but crashed on line 159 since it could not load the bval file.
Having all the loading at the beginning would instead fail earlier and thus save some processing time for the user.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.