Craigacp / MIToolbox

Mutual Information functions for C and MATLAB
BSD 3-Clause "New" or "Revised" License
141 stars 59 forks source link

input datatype #1

Closed iBM88 closed 8 years ago

iBM88 commented 9 years ago

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.

Craigacp commented 9 years ago

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.

edobez commented 8 years ago

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.

Craigacp commented 8 years ago

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?

edobez commented 8 years ago

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

Craigacp commented 8 years ago

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

edobez commented 8 years ago

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 https://github.com/Craigacp/MIToolbox/issues/1#issuecomment-169773463.

Craigacp commented 8 years ago

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.