Comments (6)
What datatype is your image? You use niimath to detect the data type:
$ niimath $SUBJECTS_DIR/sub-OAS30001_ses-d0129_T1w/mri/lh.amygdala_mask-in-rawavg.nii.gz
<nifti_image
nifti_type = 'NIFTI-1+'
header_filename = 'sag_int_36sl_21.nii'
image_filename = 'sag_int_36sl_21.nii'
image_offset = '352'
ndim = '4'
nx = '64'
ny = '64'
nz = '36'
nt = '2'
dx = '3.25'
dy = '3.25'
dz = '3.6'
dt = '3'
datatype = '4'
datatype_name = 'INT16'
nii2mesh only supports the most popular data types (DT_UINT8 DT_UINT16 DT_INT16 DT_FLOAT32). Since niimath exports to float32 by default, you could try:
niimath $SUBJECTS_DIR/sub-OAS30001_ses-d0129_T1w/mri/lh.amygdala_mask-in-rawavg.nii.gz -add 0 flt32
from nii2mesh.
Thanks for your comment. As you can see below, the datatype of this nifti file is 'INT32'
$ niimath $SUBJECTS_DIR/sub-OAS30001_ses-d0129_T1w/mri/lh.amygdala_mask-in-rawavg.nii.gz
<nifti_image
nifti_type = 'NIFTI-1+'
header_filename = '/Applications/freesurfer/7.2.0/trial2/sub-OAS30001_ses-d0129_T1w/mri/lh.amygdala_mask-in-rawavg.nii.gz'
image_filename = '/Applications/freesurfer/7.2.0/trial2/sub-OAS30001_ses-d0129_T1w/mri/lh.amygdala_mask-in-rawavg.nii.gz'
image_offset = '352'
ndim = '3'
nx = '176'
ny = '256'
nz = '256'
dx = '0.999998'
dy = '1'
dz = '1'
datatype = '8'
datatype_name = 'INT32'
nvox = '11534336'
nbyper = '4'
byteorder = 'LSB_FIRST'
xyz_units = '2'
xyz_units_name = 'mm'
time_units = '8'
time_units_name = 's'
descrip = 'FreeSurfer Jul 13 2021'
qform_code = '1'
qform_code_name = 'Scanner Anat'
qto_xyz_matrix = '0.996803 -0.013412 0.0787298 -89.019 0.00732101 0.996993 0.0771508 -108.054 -0.0795276 -0.076328 0.993906 -146.884 0 0 0 1'
qto_ijk_matrix = '0.996808 0.00732104 -0.0795279 77.8446 -0.013412 0.996993 -0.076328 95.3233 0.0787298 0.0771508 0.993906 161.334 0 0 0 1'
quatern_b = '-0.0384288'
quatern_c = '0.0396253'
quatern_d = '0.00519125'
qoffset_x = '-89.019'
qoffset_y = '-108.054'
qoffset_z = '-146.884'
qfac = '1'
qform_i_orientation = 'Left-to-Right'
qform_j_orientation = 'Posterior-to-Anterior'
qform_k_orientation = 'Inferior-to-Superior'
sform_code = '1'
sform_code_name = 'Scanner Anat'
sto_xyz_matrix = '0.996803 -0.013412 0.0787298 -89.019 0.00732101 0.996993 0.0771508 -108.054 -0.0795276 -0.076328 0.993906 -146.884 0 0 0 1'
sto_ijk matrix = '0.996808 0.00732104 -0.0795279 77.8446 -0.013412 0.996993 -0.076328 95.3233 0.0787298 0.0771508 0.993906 161.334 0 0 0 1'
sform_i_orientation = 'Left-to-Right'
sform_j_orientation = 'Posterior-to-Anterior'
sform_k_orientation = 'Inferior-to-Superior'
num_ext = '0'
/>
However, after running the code
niimath $SUBJECTS_DIR/sub-OAS30001_ses-d0129_T1w/mri/lh.amygdala_mask-in-rawavg.nii.gz -add 0 flt32
I recheck its datatype, nothing changed.
<nifti_image
nifti_type = 'NIFTI-1+'
header_filename = '/Applications/freesurfer/7.2.0/trial2/sub-OAS30001_ses-d0129_T1w/mri/lh.amygdala_mask-in-rawavg.nii.gz'
image_filename = '/Applications/freesurfer/7.2.0/trial2/sub-OAS30001_ses-d0129_T1w/mri/lh.amygdala_mask-in-rawavg.nii.gz'
image_offset = '352'
ndim = '3'
nx = '176'
ny = '256'
nz = '256'
dx = '0.999998'
dy = '1'
dz = '1'
datatype = '8'
datatype_name = 'INT32'
nvox = '11534336'
nbyper = '4'
byteorder = 'LSB_FIRST'
xyz_units = '2'
xyz_units_name = 'mm'
time_units = '8'
time_units_name = 's'
descrip = 'FreeSurfer Jul 13 2021'
qform_code = '1'
qform_code_name = 'Scanner Anat'
qto_xyz_matrix = '0.996803 -0.013412 0.0787298 -89.019 0.00732101 0.996993 0.0771508 -108.054 -0.0795276 -0.076328 0.993906 -146.884 0 0 0 1'
qto_ijk_matrix = '0.996808 0.00732104 -0.0795279 77.8446 -0.013412 0.996993 -0.076328 95.3233 0.0787298 0.0771508 0.993906 161.334 0 0 0 1'
quatern_b = '-0.0384288'
quatern_c = '0.0396253'
quatern_d = '0.00519125'
qoffset_x = '-89.019'
qoffset_y = '-108.054'
qoffset_z = '-146.884'
qfac = '1'
qform_i_orientation = 'Left-to-Right'
qform_j_orientation = 'Posterior-to-Anterior'
qform_k_orientation = 'Inferior-to-Superior'
sform_code = '1'
sform_code_name = 'Scanner Anat'
sto_xyz_matrix = '0.996803 -0.013412 0.0787298 -89.019 0.00732101 0.996993 0.0771508 -108.054 -0.0795276 -0.076328 0.993906 -146.884 0 0 0 1'
sto_ijk matrix = '0.996808 0.00732104 -0.0795279 77.8446 -0.013412 0.996993 -0.076328 95.3233 0.0787298 0.0771508 0.993906 161.334 0 0 0 1'
sform_i_orientation = 'Left-to-Right'
sform_j_orientation = 'Posterior-to-Anterior'
sform_k_orientation = 'Inferior-to-Superior'
num_ext = '0'
/>
lh.amygdala_mask-in-rawavg.nii.gz
So demo still doesn't support the data type (solution:use niimath)
how to use niimath to solve this problem? I attached the sample nifti file here so that you can have a try on it. Thanks for your help!
from nii2mesh.
Your call to niimath
created a new image named flt32.nii.gz
that will be in float 32 format. The idea was to create a copy of your input image.
from nii2mesh.
Oh, sorry for my being unfamiliar with this toolbox. Brilliant idea! It saves my work!
But I have multiple works and how can I define the name and path of the output images?
from nii2mesh.
You can use Python, Matlab or bash scripts to automate this. FSL has a lot of helper bash functions to automate tasks. The inner loopo of your bash script would look like:
niimath ${inname} -dehaze 5 temp
nii2mesh temp -dehaze 5 ${inname}
from nii2mesh.
Thanks again! Here is my final code
#!/bin/tcsh
foreach subject (sub*)
niimath $SUBJECTS_DIR/{$subject}/mri/rh.amygdala_mask-in-rawavg.nii.gz -add 0 $SUBJECTS_DIR/{$subject}/mri/rh.amygdala_mask-in-rawavg.(flt32).nii.gz
./nii2mesh $SUBJECTS_DIR/{$subject}/mri/rh.amygdala_mask-in-rawavg.(flt32).nii.gz -q 2 -p 1 -l 0 $SUBJECTS_DIR/{$subject}/mri/lh.amygdala_q2p1l0.gz
end
from nii2mesh.
Related Issues (9)
- Request for the release for Windows
- segfault when meshing a volume with non-zero voxels on the bounding-box HOT 2
- Compile on Win10 HOT 1
- License text in quadric.h HOT 1
- "double free or corruption (!prev)" in quadric_simplify_mesh HOT 5
- Scope of functions defined in quadric.c HOT 5
- Missing releases HOT 2
- incomplete conversion HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nii2mesh.