Prev: Coastline Mapping
Next: help, need some advice
From: Daniel on 17 Oct 2009 06:15 Hi, i have some problem with normalization of a 64*64 matrix containing valuses of span 973 - 1073. I want them to normalized into the scale 0 - 1 without loosing the grayscale level. Hope somebody can give me a hint or tip in how to solve this problem. /Daniel
From: Nasser M. Abbasi on 17 Oct 2009 06:23 "Daniel " <oldan(a)student.chalmers.se> wrote in message news:hbc5fh$pmi$1(a)fred.mathworks.com... > Hi, i have some problem with normalization of a 64*64 matrix containing > valuses of span 973 - 1073. I want them to normalized into the scale 0 - 1 > without loosing the grayscale level. Hope somebody can give me a hint or > tip in how to solve this problem. > > /Daniel let original range be MAX=1073, MIN=973, let the scaled range be max=1 and min=0 let a specific value in the matrix y, let the scaled value be z, then for linear scaling we must have (MAX-MIN) / (max-min) = (MAX-y) / (max-z) solve for z --Nasser
From: Daniel on 17 Oct 2009 07:30 "Nasser M. Abbasi" <nma(a)12000.org> wrote in message <IWgCm.10332$Ku5.6168(a)newsfe04.iad>... > > "Daniel " <oldan(a)student.chalmers.se> wrote in message > news:hbc5fh$pmi$1(a)fred.mathworks.com... > > Hi, i have some problem with normalization of a 64*64 matrix containing > > valuses of span 973 - 1073. I want them to normalized into the scale 0 - 1 > > without loosing the grayscale level. Hope somebody can give me a hint or > > tip in how to solve this problem. > > > > /Daniel > > let original range be MAX=1073, MIN=973, let the scaled range be max=1 and > min=0 > > let a specific value in the matrix y, let the scaled value be z, then for > linear scaling we must have > > > (MAX-MIN) / (max-min) = (MAX-y) / (max-z) > > solve for z > > --Nasser > > Tanks for your reply. There are still some problem with the rescale, the images I1 and I1_norm does not looks the same. Maybe you can see if im doing something wrong? I?m working with DICOM files. As you can see in I1 i have to choose the interval [1059-175,1059+175], but what would this be in the rescaled image? metadata1=dicominfo('26mAs_120kV_0_0_rot0.dcm'); I1=dicomread(metadata1); figure imshow(I1,[1059-175,1059+175]) I1=double(I1); C_max=max(I1(:)); C_min=min(I1(:)); c_max=1; c_min=0; for s=1:64; for t=1:64; I1_norm(s,t)=((I1(s,t))-(C_min))/100; end end figure imshow(I1_norm) /Daniel
From: Daniel on 17 Oct 2009 09:08 "Daniel " <oldan(a)student.chalmers.se> wrote in message <hbc9sc$ose$1(a)fred.mathworks.com>... > "Nasser M. Abbasi" <nma(a)12000.org> wrote in message <IWgCm.10332$Ku5.6168(a)newsfe04.iad>... > > > > "Daniel " <oldan(a)student.chalmers.se> wrote in message > > news:hbc5fh$pmi$1(a)fred.mathworks.com... > > > Hi, i have some problem with normalization of a 64*64 matrix containing > > > valuses of span 973 - 1073. I want them to normalized into the scale 0 - 1 > > > without loosing the grayscale level. Hope somebody can give me a hint or > > > tip in how to solve this problem. > > > > > > /Daniel > > > > let original range be MAX=1073, MIN=973, let the scaled range be max=1 and > > min=0 > > > > let a specific value in the matrix y, let the scaled value be z, then for > > linear scaling we must have > > > > > > (MAX-MIN) / (max-min) = (MAX-y) / (max-z) > > > > solve for z > > > > --Nasser > > > > Tanks for your reply. There are still some problem with the rescale, the images I1 and I1_norm does not looks the same. Maybe you can see if im doing something wrong? I?m working with DICOM files. As you can see in I1 i have to choose the interval [1059-175,1059+175], but what would this be in the rescaled image? > > metadata1=dicominfo('26mAs_120kV_0_0_rot0.dcm'); > I1=dicomread(metadata1); > > figure > imshow(I1,[1059-175,1059+175]) > > I1=double(I1); > C_max=max(I1(:)); > C_min=min(I1(:)); > c_max=1; > c_min=0; > > for s=1:64; > for t=1:64; > I1_norm(s,t)=((I1(s,t))-(C_min))/100; > end > end > figure > imshow(I1_norm) > > /Daniel Hi, if i want to do the inverse i.e. go from values of 0 - 1 to values of 973 - 1073, could i use the same formula as u suggested earlier? and how? /Daniel
From: Nasser M. Abbasi on 17 Oct 2009 09:51
"Daniel " <oldan(a)student.chalmers.se> wrote in message news:hbcfjj$q67$1(a)fred.mathworks.com... > "Daniel " <oldan(a)student.chalmers.se> wrote in message > <hbc9sc$ose$1(a)fred.mathworks.com>... >> "Nasser M. Abbasi" <nma(a)12000.org> wrote in message >> <IWgCm.10332$Ku5.6168(a)newsfe04.iad>... >> > >> > "Daniel " <oldan(a)student.chalmers.se> wrote in message >> > news:hbc5fh$pmi$1(a)fred.mathworks.com... >> > > Hi, i have some problem with normalization of a 64*64 matrix >> > > containing >> > > valuses of span 973 - 1073. I want them to normalized into the scale >> > > 0 - 1 >> > > without loosing the grayscale level. Hope somebody can give me a hint >> > > or >> > > tip in how to solve this problem. >> > > >> > > /Daniel >> > >> > let original range be MAX=1073, MIN=973, let the scaled range be max=1 >> > and >> > min=0 >> > >> > let a specific value in the matrix y, let the scaled value be z, then >> > for >> > linear scaling we must have >> > >> > >> > (MAX-MIN) / (max-min) = (MAX-y) / (max-z) >> > >> > solve for z >> > >> > --Nasser >> > >> > Tanks for your reply. There are still some problem with the rescale, >> > the images I1 and I1_norm does not looks the same. Maybe you can see if >> > im doing something wrong? I?m working with DICOM files. As you can see >> > in I1 i have to choose the interval [1059-175,1059+175], but what would >> > this be in the rescaled image? >> >> metadata1=dicominfo('26mAs_120kV_0_0_rot0.dcm'); >> I1=dicomread(metadata1); >> >> figure >> imshow(I1,[1059-175,1059+175]) >> >> I1=double(I1); >> C_max=max(I1(:)); >> C_min=min(I1(:)); >> c_max=1; >> c_min=0; >> >> for s=1:64; >> for t=1:64; >> I1_norm(s,t)=((I1(s,t))-(C_min))/100; >> end >> end >> figure >> imshow(I1_norm) >> >> /Daniel > > Hi, if i want to do the inverse i.e. go from values of 0 - 1 to values of > 973 - 1073, could i use the same formula as u suggested earlier? and how? > > /Daniel Yes, sure. just make MAX=1 and MIN=0 and max=1073 and min=973 and let a specific value in the scaled version be z, let the original value be y then (MAX-MIN) / (max-min) = (MAX-z) / (max-y) and solve for y. This formula is nothing special, it just says the mapping is linear between orginal points distribution and the new points distribution. Not sure how to help you with your other issue now, got to run now. hopefully someone else can help you. --Nasser |