CoBrALab / antsRegistration-MAGeT

A reimplementation of MAGeTbrain using only ANTs tools.
Other
16 stars 6 forks source link

Compare ImageMath majority_vote to voxel_vote from minc-stuffs #7

Closed gdevenyi closed 8 years ago

gdevenyi commented 8 years ago

If they work the same, we can reduce dependencies.

pipitone commented 8 years ago

Actually, just had reason to try this. I compared majority vote of 5 copies of winterburn atlas subject 1's labels with ImageMath (from minc-toolkit/1.9.10) and voxel_vote (from minc-stuffs):

$ time ImageMath 3 imagemath.mnc labels.mnc labels.mnc labels.mnc labels.mnc labels.mnc

real    3m22.604s
user    3m3.999s
sys     0m7.436s

$ time minc-stuffs/python/voxel_vote labels.mnc labels.mnc labels.mnc labels.mnc labels.mnc voxel_vote.mnc

real    1m57.102s
user    1m50.761s
sys     0m0.836s

$ mincdiff voxel_vote.mnc imagemath.mnc
1c1
< hdf5 voxel_vote {
---
> hdf5 imagemath {
7c7
<   short image(xspace, zspace, yspace) ;
---
>   int image(zspace, yspace, xspace) ;
11c11
<       image:dimorder = "xspace,zspace,yspace" ;
---
>       image:dimorder = "zspace,yspace,xspace" ;
13c13
<       image:signtype = "unsigned" ;
---
>       image:signtype = "signed__" ;
24c24
<       xspace:width = 0. ;
---
>       xspace:width = 1. ;
29a30
>       xspace:comments = "X increases from patient left to right" ;
36c37
<       yspace:width = 0. ;
---
>       yspace:width = 1. ;
40c41
<       yspace:direction_cosines = -0., 1., -0. ;
---
>       yspace:direction_cosines = 0., 1., 0. ;
41a43
>       yspace:comments = "Y increases from patient posterior to anterior" ;
48c50
<       zspace:width = 0. ;
---
>       zspace:width = 1. ;
52c54
<       zspace:direction_cosines = -0., -0., 1. ;
---
>       zspace:direction_cosines = 0., 0., 1. ;
53a56
>       zspace:comments = "Z increases from patient inferior to superior" ;
60c63
<       :ident = "jp:kandel:2015.11.27.19.04.04:58218:1" ;
---
>       :ident = "jp:kandel:2015.11.27.19.06.43:58089:1" ;
63d65
<       :history = "2015-11-27 19:05:54 >>> (default history added after pyminc usage) minc-stuffs/python/voxel_vote labels.mnc labels.mnc labels.mnc labels.mnc labels.mnc voxel_vote.mnc" ;
Binary image comparison:
/var/tmp/mincdiff-61018-body1 /var/tmp/mincdiff-61018-body2 differ: byte 143899889, line 1

So, some dim order and width changes, but otherwise the data itself is mostly identical. Funnily enough ImageMath takes longer..

gdevenyi commented 8 years ago

ImageMath probably takes longer because it writes out larger datatypes (might be IO wait)

gdevenyi commented 8 years ago

Seems to work, will use for now.