Craigacp / MIToolbox

Mutual Information functions for C and MATLAB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

input datatype

iBM88 opened this issue · comments

The code gets to the following error while running MIToolbox on uint8 data types:
"Out of memory. Type HELP MEMORY for your options."

However it works well with double data type.

Yes, the C code expects all the inputs to be doubles, and it assumes that any input handed by Matlab will be a double (through an explicit cast). The Matlab wrappers probably should be modified to test the arrays and convert them to doubles first, though this will be slow if the user doesn't realise it's happening.

Hello, I have faced the same problem as @iBM88 had until I started looking for help online.
I think this should be written in the README since it's quite an important thing.
Also there are some kinds of inputs which make MATLAB crash (at least in R2015a), for example when they are matrices instead of column vectors.

I'll work on the README at the weekend, it could do with a touch up.

What kind of inputs make it crash? Is this directly calling the mex functions or using the MATLAB wrappers?

Matrix inputs and uint8 vectors. It crashed calling the MATLAB wrapper mi.

So you called mi(X,Y) where X & Y were both matrices of uint8 values?

Yes, for example:
I = imread('cameraman.tif');
mi(I,I) --> crashes
mi(I(:),(:)) --> crashes

On Thu, Jan 7, 2016 at 10:57 AM, Adam Pocock notifications@github.com
wrote:

So you called mi(X,Y) where X & Y were both matrices of uint8 values?


Reply to this email directly or view it on GitHub
#1 (comment).

Ok. I've added checks to the MATLAB wrappers so they reject inputs which aren't doubles. It should now throw an error message rather than crashing MATLAB.