ncullen93 / mesh2nifti Goto Github PK
View Code? Open in Web Editor NEWConvert a .msh file in the simNIBS format to a .nii.gz file
Convert a .msh file in the simNIBS format to a .nii.gz file
Hi, thanks for this useful code!
I was wondering if it is possible to run this on windows? I am having issues with the install_simnibs_NCC.sh script.
Thank you!
Athena
Hello,
This looks to be very useful, though I ran into an error while running it on this mesh file: https://iu.box.com/s/2n7l0cx1p1mdgl2zlbbhlx0wr380a9sj
Here's the error below, with much appreciation for what is probably a simple fix.
Thanks!
[cclab@torch simnibs_sim]$ msh2nifti -mesh almi5_001_tdcs_scalar_171009-194715_final.msh -t1 /data/hammer/space0/nidbs_pilot/simnibs/example/simnibs2.0_example/almi5_T1fs_conform.nii.gz -out /data/hammer/space0/nidbs_pilot/simnibs/example/simnibs2.0_example/test.nii.gz --verbose
Mesh File: almi5_001_tdcs_scalar_171009-194715_final.msh
T1 File: /data/hammer/space0/nidbs_pilot/simnibs/example/simnibs2.0_example/almi5_T1fs_conform.nii.gz
View: 2
Field: normE
Voxel Size: 1 mm^3
gmsh_numpy.py: Reading almi5_001_tdcs_scalar_171009-194715_final.msh in binary with 655656 nodes
0.181132078171 seconds to read $Nodes almi5_001_tdcs_scalar_171009-194715_final.msh
reading triangle block of 895574 triangles
reading triangle block of 3671308 tetrahedra
2.22894096375 seconds to read $EndElements almi5_001_tdcs_scalar_171009-194715_final.msh
6.48640298843 seconds to read almi5_001_tdcs_scalar_171009-194715_final.msh
Found 858200 relevant elements
Getting mesh data..
Applying inverse transform to Mesh coordinates..
min/max X coordinate: 61 195
min/max Y coordinate: 33 202
min/max Z coordinate: 65 183
Pre-mapping candidate elements for each voxel..
Voxelizing the Mesh at size 1mm^3
1%|? | 1/134 [00:01<03:24, 1.54s/it]
Traceback (most recent call last):
File "/usr/local/simnibs/fem_efield/msh2nifti", line 350, in
output_file=args.out, verbose=args.verbose)
File "/usr/local/simnibs/fem_efield/msh2nifti", line 291, in msh2nifti
data[x:(x+vox),y:(y+vox),z:(z+vox)] = gray_vals[cand_idx]
ValueError: could not broadcast input array from shape (3) into shape (1,1,1)
[cclab@torch simnibs_sim]$
First of all, thanks a lot for making this function publically available! It works like a charm for most of my participants, in a few however I get an error when trying to create the grey matter images (see file attached). The mesh itself looks fine, btw. Any idea what could cause this and how to solve it? Best, Inge
Had to remove nibabel and nilearn from conda create at line 81 and added the following two lines at line 84:
$TARGET_DIR/miniconda2/envs/simnibs_env/bin/pip install nilearn
$TARGET_DIR/miniconda2/envs/simnibs_env/bin/pip install scikit-learn
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.