colorbar for decimal images

View: New views
5 Messages — Rating Filter:   Alert me  

colorbar for decimal images

by Lorenzo Trojan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi all,

sorry for asking this question, I've been looking around but I couldn't find a solution to this.

I have a matrix of intensities. The intensity of each pixel is a double number ranging from e-4 to e-3 and I'd like to produce an image using image() or imshow() and add a colorbar showing the correct range of values. I could do something like:

> minmat = min (min (matrix)) ;
> maxmat = max (max (matrix)) ;
> delmat = maxmat - minmat ;
> imgmat = (matrix + minmat) * 64 / delmat ;
> image (imgmat);
> colormat (hot (64)) ;
> colorbar ();

but then the colorbar would show the range from 1 to 64.

is there a way to change the labels to the colorbar so that it display the range of the original image limits? I tried to look for the axis object associated with the colorbar, but I could't find them...

Thanks,
Lorenzo


_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: colorbar for decimal images

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Oct 30, 2009, at 7:54 AM, Lorenzo Trojan <lorenzotrojan@...> wrote:

Hi all,

sorry for asking this question, I've been looking around but I couldn't find a solution to this.

I have a matrix of intensities. The intensity of each pixel is a double number ranging from e-4 to e-3 and I'd like to produce an image using image() or imshow() and add a colorbar showing the correct range of values. I could do something like:

> minmat = min (min (matrix)) ;
> maxmat = max (max (matrix)) ;
> delmat = maxmat - minmat ;
> imgmat = (matrix + minmat) * 64 / delmat ;
> image (imgmat);
> colormat (hot (64)) ;
> colorbar ();

but then the colorbar would show the range from 1 to 64.

is there a way to change the labels to the colorbar so that it display the range of the original image limits? I tried to look for the axis object associated with the colorbar, but I could't find them...

You can obtain the handle to the colorbar by

hc = findall (gcf, "tag", "colorbar", "type", "axes");

Or when you create the colorbar ...

hc = colorbar ();

Ben

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Parent Message unknown Re: colorbar for decimal images

by Lorenzo Trojan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Oct 30, 2009, at 7:54 AM, Lorenzo Trojan <lorenzotrojan@...
wrote:

> > Hi all,
> >
> > sorry for asking this question, I've been looking around but I 
> > couldn't find a solution to this.
> >
> > I have a matrix of intensities. The intensity of each pixel is a 
> > double number ranging from e-4 to e-3 and I'd like to produce an 
> > image using image() or imshow() and add a colorbar showing the 
> > correct range of values. I could do something like:
> >
> > > minmat = min (min (matrix)) ;
> > > maxmat = max (max (matrix)) ;
> > > delmat = maxmat - minmat ;
> > > imgmat = (matrix + minmat) * 64 / delmat ;
> > > image (imgmat);
> > > colormat (hot (64)) ;
> > > colorbar ();
> >
> > but then the colorbar would show the range from 1 to 64.
> >
> > is there a way to change the labels to the colorbar so that it 
> > display the range of the original image limits? I tried to look for 
> > the axis object associated with the colorbar, but I could't find 
> > them...
>
> You can obtain the handle to the colorbar by
>
> hc = findall (gcf, "tag", "colorbar", "type", "axes");
>
> Or when you create the colorbar ...
>
> hc = colorbar ();
>
> Ben

Hi

Thanks for the reply. I downloaded findall which didn't seem to be installed on my system, from:

http://velveeta.che.wisc.edu/cgi-bin/hgwebdir.cgi/octave/file/tip//scripts/plot/findall.m?rev=HEAD&content-type=text/plain

but is didn't work. When i use it says:

> warning: get: invalid property `showhiddenhandles'

and a bunch of other errors. the second solution also didn't work. Octave returns:

> error: value on right hand side of assignment is undefined

I've installed octave from the main Ubuntu rep:

> octave:1405> version
> ans = 3.0.1

is this octave version too old?

thanks
Lorenzo


     

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: colorbar for decimal images

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Oct 30, 2009, at 2:01 PM, Lorenzo Trojan <lorenzotrojan@...>  
wrote:

> On Oct 30, 2009, at 7:54 AM, Lorenzo Trojan <lorenzotrojan@...>
> wrote:
>
>>> Hi all,
>>>
>>> sorry for asking this question, I've been looking around but I
>>> couldn't find a solution to this.
>>>
>>> I have a matrix of intensities. The intensity of each pixel is a
>>> double number ranging from e-4 to e-3 and I'd like to produce an
>>> image using image() or imshow() and add a colorbar showing the
>>> correct range of values. I could do something like:
>>>
>>>> minmat = min (min (matrix)) ;
>>>> maxmat = max (max (matrix)) ;
>>>> delmat = maxmat - minmat ;
>>>> imgmat = (matrix + minmat) * 64 / delmat ;
>>>> image (imgmat);
>>>> colormat (hot (64)) ;
>>>> colorbar ();
>>>
>>> but then the colorbar would show the range from 1 to 64.
>>>
>>> is there a way to change the labels to the colorbar so that it
>>> display the range of the original image limits? I tried to look for
>>> the axis object associated with the colorbar, but I could't find
>>> them...
>>
>> You can obtain the handle to the colorbar by
>>
>> hc = findall (gcf, "tag", "colorbar", "type", "axes");
>>
>> Or when you create the colorbar ...
>>
>> hc = colorbar ();
>>
>> Ben
>
> Hi
>
> Thanks for the reply. I downloaded findall which didn't seem to be  
> installed on my system, from:
>
> http://velveeta.che.wisc.edu/cgi-bin/hgwebdir.cgi/octave/file/tip//scripts/plot/findall.m?rev=HEAD&content-type=text/plain
>
> but is didn't work. When i use it says:
>
>> warning: get: invalid property `showhiddenhandles'
>
> and a bunch of other errors. the second solution also didn't work.  
> Octave returns:
>
>> error: value on right hand side of assignment is undefined
>
> I've installed octave from the main Ubuntu rep:
>
>> octave:1405> version
>> ans = 3.0.1
>
> is this octave version too old?

Yes, that's too old. There may be another solution, but I don't have a  
copy of 3.0.x available right now to try.  Anyone else?

Ben
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: colorbar for decimal images

by dbateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ben Abbott wrote:
> Yes, that's too old. There may be another solution, but I don't have a  
> copy of 3.0.x available right now to try.  Anyone else?
>
>  
There was no way to set the axis values of the colorbar in 3.0.x as it
was in fact a gnuplot colorbox under the control of gnuplot itself..
This was one of the reasons that colorbar was reimplemented as an image
in 3.2.x

D.

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave