Prev: Runtime Error when running executable file
Next: randomly placed shapes moving laterally, horizontally, or increasing in size
From: us on 12 Jun 2010 18:01 "Ali Al-Radaideh" <aliradaideh(a)yahoo.com> wrote in message <hv0vcg$h7l$1(a)fred.mathworks.com>... > Dear All, > > I have got a Grey scale image and managed to map its values using the colormap('Jet') such that the maximum value(s) has/have a red color and the lowest value(s) has/have a blue color. Now I simply need to reverse this such that the largest value(s) has/have a blue color ...etc. > > I used the code colormap(flipud('Jet')) but did not make any changes. Here is the code i have used; > > colormap(flipud('Jet')) > imagesc(rot90(T1_sc(:,:,29)),[500 2500]); > colorbar; > > The image name is T1_sc. > Any ideas why did not work, please? > > Many thanks in advance > Ali well... yes: carefully look at what you do and think... one of the solutions cm=flipud('jet') % cm = jet % now, try cm=flipud(jet); colormap(cm); colorbar; us
From: ImageAnalyst on 12 Jun 2010 19:33 Call colormap AFTER you call imagesc.
From: us on 12 Jun 2010 19:40 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <c31cad43-f0c4-4586-b24f-aeeaf3aa6039(a)f7g2000vbl.googlegroups.com>... > Call colormap AFTER you call imagesc. ??? ia, this would NOT solve the OP's problem, though... us
From: ImageAnalyst on 12 Jun 2010 19:56 On Jun 12, 7:40 pm, "us " <u...(a)neurol.unizh.ch> wrote: > ImageAnalyst <imageanal...(a)mailinator.com> wrote in message <c31cad43-f0c4-4586-b24f-aeeaf3aa6...(a)f7g2000vbl.googlegroups.com>... > > Call colormap AFTER you call imagesc. > > ??? > ia, this would NOT solve the OP's problem, though... > > us --------------------------------------------------- You're right. I didn't notice that he had quotes around jet, and removing the quotes fixes it. I was just thinking that when you call imagesc (which I rarely do since I prefer imshow) that it applies some default color map and that if you wanted a special/different one you'd have to do it after your image was displayed. However it appears (after testing) that if you assign the colormap before you have even created/displayed the image axes, it seems to keep that colormap and not use the default one. That seems a little counterintuitive to me (that a colormap set before an object was even created should take effect), but I guess that's the way it works.
From: us on 12 Jun 2010 20:35
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <9b251876-32f2-4e65-88cd-37b66aece343(a)u26g2000yqu.googlegroups.com>... > On Jun 12, 7:40 pm, "us " <u...(a)neurol.unizh.ch> wrote: > > ImageAnalyst <imageanal...(a)mailinator.com> wrote in message <c31cad43-f0c4-4586-b24f-aeeaf3aa6...(a)f7g2000vbl.googlegroups.com>... > > > Call colormap AFTER you call imagesc. > > > > ??? > > ia, this would NOT solve the OP's problem, though... > > > > us > > --------------------------------------------------- > You're right. I didn't notice that he had quotes around jet, and > removing the quotes fixes it. I was just thinking that when you call > imagesc (which I rarely do since I prefer imshow) that it applies some > default color map and that if you wanted a special/different one you'd > have to do it after your image was displayed. However it appears > (after testing) that if you assign the colormap before you have even > created/displayed the image axes, it seems to keep that colormap and > not use the default one. That seems a little counterintuitive to me > (that a colormap set before an object was even created should take > effect), but I guess that's the way it works. note that COLORMAP sets the map of the GCF or - if no fig exists - creates a fig and sets its map... hence, if you set the map, then create another fig, the latter will use the default color map... thus, i fully agree -and in fact- most CSSMers set the colormap after they created the fig... us |