[MINC-users] mincstats histogram count limit?

Andrew Wood andrew at biospective.com
Mon Nov 25 12:10:37 EST 2013


Hi all,

The problem goes away if the histogram array is changed to double, as AJ
suggested. There are a few other float arrays used in this bit of code: bin
centres, probability density function and cumulative density function. They
don't seem to be causing problems right now, but might it make sense to
change those over to double while I'm at at?

- Andrew


On Sat, Nov 16, 2013 at 12:29 AM, Andrew Janke <a.janke at gmail.com> wrote:

> On 15 November 2013 20:17, Alex Zijdenbos <zijdenbos at gmail.com> wrote:
> > $ mincstats -clobber -quiet -none -integer_histogram -hist_range 1 3
> > -histogram hr_hist.txt hr.mnc
> > 451431944
> > $ cat hr_hist.txt
> > # histogram for: hr.mnc
> > #  mask file:    (null)
> > #  domain:       0.5  3.5
> > #  entropy:      1.32723
> > # bin centres                 counts
> >   1                      1.67322e+07
> >   2                      1.67772e+07
> >   3                      1.67772e+07
> >
> > However:
> >
> > $ mincstats -clobber -none -count -binvalue 1,2,3 hr.mnc
> > Included Range:    0.5   1.5
> > # voxels:          16732212
> > Included Range:    1.5   2.5
> > # voxels:          42817611
> > Included Range:    2.5   3.5
> > # voxels:          35033439
> >
> > The red and green results _should_ be the same; but in the histogram
> output
> > the seem to be capped at 1.67772e+07, which is clearly wrong.
> >
> > Anybody able to figure this out?
>
> Strange..
>
> This looks to me more like a memory error in that only the first count
> is printed, the histogram range calculation has always been a bit of
> black magic that made sense at the time it was written! and then Peter
> and Bert both had a go at adding things to it.
>
> For some reason I also note that the histogram array is a float and
> everything else is double. Is there a chance that this is a cast
> problem that only shows up on 64 bit?  Can you change line 154:
>
>
> https://github.com/BIC-MNI/minc-tools/blob/master/progs/mincstats/mincstats.c#L154
>
> To double and test?
>
>
> a
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>


More information about the MINC-users mailing list