rordenlab / niimath

niimath - a clone of fslmaths. Try the live demo:
https://niivue.github.io/niivue-niimath/
Other
53 stars 15 forks source link

-roi option not working #26

Closed khchuang closed 3 weeks ago

khchuang commented 1 month ago

I use niimath on MacOS Sonoma with M2 chip. The -roi option only generated an image with all 0. The original fslmaths works fine.

neurolabusc commented 1 month ago

I am unable to replicate. I get identical results:

git clone git@github.com:rordenlab/niimath_tests.git
cd niimath_tests
fslmaths ./in/AIL -roi 5 19 3 22 2 28 0 1 fslout
niimath ./in/AIL -roi 5 19 3 22 2 28 0 1 niiout
niimath fslout --compare niiout
./conformance.sh

The final conformance script compares all possible orthogonal orientations (AIL AIR ALI ALS ARI ARS ASL ASR IAL IAR ILA ILP IPL IPR IRA IRP LAI LAS LIA LIP LPI LPS LSA LSP PIL PIR PLI PLS PRI PRS PSL PSR RAI RAS RIA RIP RPI RPS RSA RSP SAL SAR SLA SLP SPL SPR SRA SRP).

Please provide an example that illustrates the difference. If the dataset is large, you can share it with my institutional email.

khchuang commented 1 month ago

Thanks for the test. Here is an example ROI mask with only two slices. I used the following the separate the part in slice 0: niimath maskPCA -roi 0 -1 0 -1 0 1 0 -1 maskP1 The result is always 0....

maskPCA.nii.gz

neurolabusc commented 1 month ago

OK, so the issue is that for ROI Inputting -1 for a size will set it to the full image extent for that dimension. This is fixed with the latest commit and will be included in the next stable release. Please test and report if this resolves your issue.