From: Matteo on
Is there any built in function that would test input data to verify it is an image, and if not converts it using mat2gray. If not, does anybody have any suggestion as to how it could be accomoplished? Thank you
From: us on
"Matteo " <matteo.niccoli(a)gmail.com> wrote in message <hrump1$b3l$1(a)fred.mathworks.com>...
> Is there any built in function that would test input data to verify it is an image, and if not converts it using mat2gray. If not, does anybody have any suggestion as to how it could be accomoplished? Thank you

what ...in your view... constitutes an image in ML...
in my view, any numeric or logical ML var may be considered an image...

us
From: Matteo on
"us " <us(a)neurol.unizh.ch> wrote in message <hrv8dc$jqm$1(a)fred.mathworks.com>...
> "Matteo " <matteo.niccoli(a)gmail.com> wrote in message <hrump1$b3l$1(a)fred.mathworks.com>...
> > Is there any built in function that would test input data to verify it is an image, and if not converts it using mat2gray. If not, does anybody have any suggestion as to how it could be accomoplished? Thank you
>
> what ...in your view... constitutes an image in ML...
> in my view, any numeric or logical ML var may be considered an image...
>
> us

I think I was not specific enough. A better suited question for my case would be: is there any way to automatically detect if the input matrix of raw data (which is in double format, by the way) does not have the range of values that would normally be expected for an intensity image (0 to 1)? And if so, convert it to that scale using mat2gray.
For instance, one of my matrices have data between negative 5.9834 and positive 2.9969.

I got this suggestion from a blogger whuch is quite promising
if any(A(:)<0 | A(:)>1)

Thank you