Home > bioelectromagnetism > avw_poi.m

avw_poi

PURPOSE ^

File/function name: poi.m (Pixels Of Interest)

SYNOPSIS ^

function poi(slice_no,selection);

DESCRIPTION ^

 File/function name:  poi.m   (Pixels Of Interest)
         Written by:  Tim DeMonte
               Date:  Mar 27, 2001
            Version:  1.0
        Description:  A tool for studying Regions of Interest (ROI)
                      defined by selected groups of pixels in 2D
                      images taken from multi-slice (3D) data sets.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function poi(slice_no,selection);
0002 
0003 % File/function name:  poi.m   (Pixels Of Interest)
0004 %         Written by:  Tim DeMonte
0005 %               Date:  Mar 27, 2001
0006 %            Version:  1.0
0007 %        Description:  A tool for studying Regions of Interest (ROI)
0008 %                      defined by selected groups of pixels in 2D
0009 %                      images taken from multi-slice (3D) data sets.
0010 %
0011 
0012 global image Jmax Jtotal doublemap
0013 global ROI_1 ROI_1sum ROI_1no ROI_1mean ROI_1std ROI_1min ROI_1max
0014 global ROI_1percent
0015 global h1 h2
0016 global rad1 rad2 rad3
0017 global editbox1 editbox2 editbox3 editbox4 editbox5 editbox6 editbox7 editbox8
0018 if nargin<2,
0019    selection=0;
0020    clear global ROI_1 ROI_1mean ROI_1std ROI_1min ROI_1max ROI_1percent
0021 end
0022 
0023 if selection==0,
0024    
0025    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0026    %%% Modify these lines to read in a particular image file               %%%
0027    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0028    load Jxyz.mat;
0029    image=Jz(:,:,slice_no);
0030    Jtotal=sum(sum(image(:,:)));
0031    
0032    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0033    %%% Modify this line to specify the maximum range of data to display    %%%
0034    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0035    Jmax=15;
0036    
0037    ROI_1mean=0;
0038    ROI_1std=0;
0039    ROI_1min=0;
0040    ROI_1max=0;
0041    ROI_1sum=0;
0042    ROI_1no=0;
0043    dfc=get(0,'defaultfigurecolor');
0044    gui_dim=[200,100,820,625];
0045    figure('name',...
0046       'POI (Pixels of Interest)',...
0047       'numbertitle','off','position',gui_dim,'menubar','none');
0048    h1=imagesc(image(:,:),[-Jmax Jmax]);
0049    axis square
0050    pwr=0.5; % exponent for colormap (1 is linear)
0051    for m=1:128
0052       if m<64
0053          doublemap(m,1)=((m-1)./64).^pwr;
0054          doublemap(m,2)=((m-1)./64).^pwr;
0055          doublemap(m,3)=1;
0056       elseif m>64
0057          doublemap(m,1)=1;
0058          doublemap(m,2)=((128-m)./64).^pwr;
0059          doublemap(m,3)=((128-m)./64).^pwr;
0060       else
0061          doublemap(m,1)=1;
0062          doublemap(m,2)=1;
0063          doublemap(m,3)=1;
0064       end
0065    end
0066    colormap(doublemap)
0067    colorbar
0068    set(h1,'buttondownfcn','global slice_no,poi(slice_no,1),clear slice_no');
0069    
0070    % Text
0071    uicontrol('style','text','position',[5,440,80,20],...
0072       'string','Mean of ROI:','backgroundcolor',dfc,'foregroundcolor','black',...
0073       'fontname','ms sans serif','fontsize',8,'fontunits','points',...
0074       'horizontalalignment','left');
0075    uicontrol('style','text','position',[5,390,80,20],...
0076       'string','Std Dev of ROI:','backgroundcolor',dfc,'foregroundcolor','black',...
0077       'fontname','ms sans serif','fontsize',8,'fontunits','points',...
0078       'horizontalalignment','left');
0079    uicontrol('style','text','position',[5,90,80,20],...
0080       'string','Last Pick Value:','backgroundcolor',dfc,'foregroundcolor','black',...
0081       'fontname','ms sans serif','fontsize',8,'fontunits','points',...
0082       'horizontalalignment','left');
0083    uicontrol('style','text','position',[5,340,80,20],...
0084       'string','Min of ROI:','backgroundcolor',dfc,'foregroundcolor','black',...
0085       'fontname','ms sans serif','fontsize',8,'fontunits','points',...
0086       'horizontalalignment','left');
0087    uicontrol('style','text','position',[5,290,80,20],...
0088       'string','Max of ROI:','backgroundcolor',dfc,'foregroundcolor','black',...
0089       'fontname','ms sans serif','fontsize',8,'fontunits','points',...
0090       'horizontalalignment','left');
0091    uicontrol('style','text','position',[5,510,90,20],...
0092       'string','Sum of ROI:','backgroundcolor',dfc,'foregroundcolor','black',...
0093       'fontname','ms sans serif','fontsize',8,'fontunits','points',...
0094       'horizontalalignment','left');
0095    uicontrol('style','text','position',[5,210,80,20],...
0096       'string','No. of Pixels:','backgroundcolor',dfc,'foregroundcolor','black',...
0097       'fontname','ms sans serif','fontsize',8,'fontunits','points',...
0098       'horizontalalignment','left');
0099    uicontrol('style','text','position',[5,160,80,20],...
0100       'string','% of Total:','backgroundcolor',dfc,'foregroundcolor','black',...
0101       'fontname','ms sans serif','fontsize',8,'fontunits','points',...
0102       'horizontalalignment','left');
0103    
0104    % Edit Boxes
0105    editbox1=uicontrol('style','edit','position',[5,420,90,20],...
0106       'string',num2str(ROI_1mean),'horizontalalignment','left',...
0107       'backgroundcolor','white');
0108    editbox2=uicontrol('style','edit','position',[5,370,90,20],...
0109       'string',num2str(ROI_1std),'horizontalalignment','left',...
0110       'backgroundcolor','white');
0111    editbox3=uicontrol('style','edit','position',[5,70,90,20],...
0112       'string','','horizontalalignment','left',...
0113       'backgroundcolor','white');
0114    editbox4=uicontrol('style','edit','position',[5,320,90,20],...
0115       'string',num2str(ROI_1min),'horizontalalignment','left',...
0116       'backgroundcolor','white');
0117    editbox5=uicontrol('style','edit','position',[5,270,90,20],...
0118       'string',num2str(ROI_1max),'horizontalalignment','left',...
0119       'backgroundcolor','white');
0120    editbox6=uicontrol('style','edit','position',[5,490,90,20],...
0121       'string',num2str(ROI_1sum),'horizontalalignment','left',...
0122       'backgroundcolor','white');
0123    editbox7=uicontrol('style','edit','position',[5,190,90,20],...
0124       'string',num2str(ROI_1no),'horizontalalignment','left',...
0125       'backgroundcolor','white');
0126    editbox8=uicontrol('style','edit','position',[5,140,90,20],...
0127       'string','','horizontalalignment','left',...
0128       'backgroundcolor','white');
0129    
0130    % Radio Buttons
0131    rad1=uicontrol('style','radiobutton','position',[5,585,90,20],...
0132       'string','Pick/Clear','min',0,'max',1,'value',1);
0133    rad2=uicontrol('style','radiobutton','position',[5,560,90,20],...
0134       'string','Big Block','min',0,'max',1,'value',0);
0135    rad3=uicontrol('style','radiobutton','position',[5,535,90,20],...
0136       'string','Zoom ON/OFF','min',0,'max',1,'value',0,...
0137       'callback','global slice_no,poi(slice_no,2),clear slice_no');
0138    
0139 elseif selection==1,
0140    pos=round(get(gca,'currentpoint'));
0141    x=[pos(1,1)-0.5 pos(1,1)-0.5;pos(1,1)-0.5 pos(1,1)+0.5;pos(1,1)+0.5 pos(1,1)+0.5;...
0142          pos(1,1)+0.5 pos(1,1)-0.5;pos(1,1)-0.5 pos(1,1)];
0143    y=[pos(1,2)-0.5 pos(1,2)+0.5;pos(1,2)+0.5 pos(1,2)+0.5;pos(1,2)+0.5 pos(1,2)-0.5;...
0144          pos(1,2)-0.5 pos(1,2)-0.5;pos(1,2)-0.5 pos(1,2)+0.5];
0145    if(get(rad1,'value')),   % Pick
0146       if(get(rad2,'value')),  % Big Block (i.e. 3x3 array)
0147          h3=line(x,y);
0148          set(h3,'color','g');
0149          %%% Check if pixel is already selected %%%
0150          if ~isempty(ROI_1),
0151             a=find(pos(1,1)==ROI_1(:,2));
0152             b=find(pos(1,2)==ROI_1(:,3));
0153             if isempty(a),
0154                ROI_1=[ROI_1;image(pos(1,2),pos(1,1)) pos(1,1) pos(1,2)];
0155             elseif isempty(b),
0156                ROI_1=[ROI_1;image(pos(1,2),pos(1,1)) pos(1,1) pos(1,2)];
0157             else
0158                c=0;
0159                for n=1:length(a),
0160                   if find(a(n)==b(:)),
0161                      c=a(n);
0162                   end
0163                end
0164                if c==0,
0165                   ROI_1=[ROI_1;image(pos(1,2),pos(1,1)) pos(1,1) pos(1,2)];
0166                end
0167             end
0168          else
0169             ROI_1=[ROI_1;image(pos(1,2),pos(1,1)) pos(1,1) pos(1,2)];
0170          end
0171          %%% End of Check ... %%%
0172          h3=line(x,y-1);
0173          set(h3,'color','g');
0174          %%% Check if pixel is already selected %%%
0175          if ~isempty(ROI_1),
0176             a=find(pos(1,1)==ROI_1(:,2));
0177             b=find(pos(1,2)-1==ROI_1(:,3));
0178             if isempty(a),
0179                ROI_1=[ROI_1;image(pos(1,2)-1,pos(1,1)) pos(1,1) pos(1,2)-1];
0180             elseif isempty(b),
0181                ROI_1=[ROI_1;image(pos(1,2)-1,pos(1,1)) pos(1,1) pos(1,2)-1];
0182             else
0183                c=0;
0184                for n=1:length(a),
0185                   if find(a(n)==b(:)),
0186                      c=a(n);
0187                   end
0188                end
0189                if c==0,
0190                   ROI_1=[ROI_1;image(pos(1,2)-1,pos(1,1)) pos(1,1) pos(1,2)-1];
0191                end
0192             end
0193          else
0194             ROI_1=[ROI_1;image(pos(1,2)-1,pos(1,1)) pos(1,1) pos(1,2)-1];
0195          end
0196          %%% End of Check ... %%%
0197          
0198          h3=line(x+1,y-1);
0199          set(h3,'color','g');
0200          %%% Check if pixel is already selected %%%
0201          if ~isempty(ROI_1),
0202             a=find(pos(1,1)+1==ROI_1(:,2));
0203             b=find(pos(1,2)-1==ROI_1(:,3));
0204             if isempty(a),
0205                ROI_1=[ROI_1;image(pos(1,2)-1,pos(1,1)+1) pos(1,1)+1 pos(1,2)-1];
0206             elseif isempty(b),
0207                ROI_1=[ROI_1;image(pos(1,2)-1,pos(1,1)+1) pos(1,1)+1 pos(1,2)-1];
0208             else
0209                c=0;
0210                for n=1:length(a),
0211                   if find(a(n)==b(:)),
0212                      c=a(n);
0213                   end
0214                end
0215                if c==0,
0216                   ROI_1=[ROI_1;image(pos(1,2)-1,pos(1,1)+1) pos(1,1)+1 pos(1,2)-1];
0217                end
0218             end
0219          else
0220             ROI_1=[ROI_1;image(pos(1,2)-1,pos(1,1)+1) pos(1,1)+1 pos(1,2)-1];
0221          end
0222          %%% End of Check ... %%%
0223          
0224          h3=line(x-1,y);
0225          set(h3,'color','g');
0226          %%% Check if pixel is already selected %%%
0227          if ~isempty(ROI_1),
0228             a=find(pos(1,1)-1==ROI_1(:,2));
0229             b=find(pos(1,2)==ROI_1(:,3));
0230             if isempty(a),
0231                ROI_1=[ROI_1;image(pos(1,2),pos(1,1)-1) pos(1,1)-1 pos(1,2)];
0232             elseif isempty(b),
0233                ROI_1=[ROI_1;image(pos(1,2),pos(1,1)-1) pos(1,1)-1 pos(1,2)];
0234             else
0235                c=0;
0236                for n=1:length(a),
0237                   if find(a(n)==b(:)),
0238                      c=a(n);
0239                   end
0240                end
0241                if c==0,
0242                   ROI_1=[ROI_1;image(pos(1,2),pos(1,1)-1) pos(1,1)-1 pos(1,2)];
0243                end
0244             end
0245          else
0246             ROI_1=[ROI_1;image(pos(1,2),pos(1,1)-1) pos(1,1)-1 pos(1,2)];
0247          end
0248          %%% End of Check ... %%%
0249          
0250          h3=line(x+1,y);
0251          set(h3,'color','g');
0252          %%% Check if pixel is already selected %%%
0253          if ~isempty(ROI_1),
0254             a=find(pos(1,1)+1==ROI_1(:,2));
0255             b=find(pos(1,2)==ROI_1(:,3));
0256             if isempty(a),
0257                ROI_1=[ROI_1;image(pos(1,2),pos(1,1)+1) pos(1,1)+1 pos(1,2)];
0258             elseif isempty(b),
0259                ROI_1=[ROI_1;image(pos(1,2),pos(1,1)+1) pos(1,1)+1 pos(1,2)];
0260             else
0261                c=0;
0262                for n=1:length(a),
0263                   if find(a(n)==b(:)),
0264                      c=a(n);
0265                   end
0266                end
0267                if c==0,
0268                   ROI_1=[ROI_1;image(pos(1,2),pos(1,1)+1) pos(1,1)+1 pos(1,2)];
0269                end
0270             end
0271          else
0272             ROI_1=[ROI_1;image(pos(1,2),pos(1,1)+1) pos(1,1)+1 pos(1,2)];
0273          end
0274          %%% End of Check ... %%%
0275          
0276          h3=line(x-1,y+1);
0277          set(h3,'color','g');
0278          %%% Check if pixel is already selected %%%
0279          if ~isempty(ROI_1),
0280             a=find(pos(1,1)-1==ROI_1(:,2));
0281             b=find(pos(1,2)+1==ROI_1(:,3));
0282             if isempty(a),
0283                ROI_1=[ROI_1;image(pos(1,2)+1,pos(1,1)-1) pos(1,1)-1 pos(1,2)+1];
0284             elseif isempty(b),
0285                ROI_1=[ROI_1;image(pos(1,2)+1,pos(1,1)-1) pos(1,1)-1 pos(1,2)+1];
0286             else
0287                c=0;
0288                for n=1:length(a),
0289                   if find(a(n)==b(:)),
0290                      c=a(n);
0291                   end
0292                end
0293                if c==0,
0294                   ROI_1=[ROI_1;image(pos(1,2)+1,pos(1,1)-1) pos(1,1)-1 pos(1,2)+1];
0295                end
0296             end
0297          else
0298             ROI_1=[ROI_1;image(pos(1,2)+1,pos(1,1)-1) pos(1,1)-1 pos(1,2)+1];
0299          end
0300          %%% End of Check ... %%%
0301          
0302          h3=line(x,y+1);
0303          set(h3,'color','g');
0304          %%% Check if pixel is already selected %%%
0305          if ~isempty(ROI_1),
0306             a=find(pos(1,1)==ROI_1(:,2));
0307             b=find(pos(1,2)+1==ROI_1(:,3));
0308             if isempty(a),
0309                ROI_1=[ROI_1;image(pos(1,2)+1,pos(1,1)) pos(1,1) pos(1,2)+1];
0310             elseif isempty(b),
0311                ROI_1=[ROI_1;image(pos(1,2)+1,pos(1,1)) pos(1,1) pos(1,2)+1];
0312             else
0313                c=0;
0314                for n=1:length(a),
0315                   if find(a(n)==b(:)),
0316                      c=a(n);
0317                   end
0318                end
0319                if c==0,
0320                   ROI_1=[ROI_1;image(pos(1,2)+1,pos(1,1)) pos(1,1) pos(1,2)+1];
0321                end
0322             end
0323          else
0324             ROI_1=[ROI_1;image(pos(1,2)+1,pos(1,1)) pos(1,1) pos(1,2)+1];
0325          end
0326          %%% End of Check ... %%%
0327          
0328          h3=line(x+1,y+1);
0329          set(h3,'color','g');
0330          %%% Check if pixel is already selected %%%
0331          if ~isempty(ROI_1),
0332             a=find(pos(1,1)+1==ROI_1(:,2));
0333             b=find(pos(1,2)+1==ROI_1(:,3));
0334             if isempty(a),
0335                ROI_1=[ROI_1;image(pos(1,2)+1,pos(1,1)+1) pos(1,1)+1 pos(1,2)+1];
0336             elseif isempty(b),
0337                ROI_1=[ROI_1;image(pos(1,2)+1,pos(1,1)+1) pos(1,1)+1 pos(1,2)+1];
0338             else
0339                c=0;
0340                for n=1:length(a),
0341                   if find(a(n)==b(:)),
0342                      c=a(n);
0343                   end
0344                end
0345                if c==0,
0346                   ROI_1=[ROI_1;image(pos(1,2)+1,pos(1,1)+1) pos(1,1)+1 pos(1,2)+1];
0347                end
0348             end
0349          else
0350             ROI_1=[ROI_1;image(pos(1,2)+1,pos(1,1)+1) pos(1,1)+1 pos(1,2)+1];
0351          end
0352          %%% End of Check ... %%%
0353          
0354          h3=line(x-1,y-1);
0355          set(h3,'color','g');
0356          %%% Check if pixel is already selected %%%
0357          if ~isempty(ROI_1),
0358             a=find(pos(1,1)-1==ROI_1(:,2));
0359             b=find(pos(1,2)-1==ROI_1(:,3));
0360             if isempty(a),
0361                ROI_1=[ROI_1;image(pos(1,2)-1,pos(1,1)-1) pos(1,1)-1 pos(1,2)-1];
0362             elseif isempty(b),
0363                ROI_1=[ROI_1;image(pos(1,2)-1,pos(1,1)-1) pos(1,1)-1 pos(1,2)-1];
0364             else
0365                c=0;
0366                for n=1:length(a),
0367                   if find(a(n)==b(:)),
0368                      c=a(n);
0369                   end
0370                end
0371                if c==0,
0372                   ROI_1=[ROI_1;image(pos(1,2)-1,pos(1,1)-1) pos(1,1)-1 pos(1,2)-1];
0373                end
0374             end
0375          else
0376             ROI_1=[ROI_1;image(pos(1,2)-1,pos(1,1)-1) pos(1,1)-1 pos(1,2)-1];
0377          end
0378          %%% End of Check ... %%%
0379          
0380          ROI_1mean=mean(ROI_1(:,1));
0381          ROI_1std=std(ROI_1(:,1));
0382          ROI_1min=min(ROI_1(:,1));
0383          ROI_1max=max(ROI_1(:,1));
0384          ROI_1sum=sum(ROI_1(:,1));
0385          [ROI_1no,n]=size(ROI_1);
0386          ROI_1percent=(ROI_1sum./Jtotal).*100;
0387          set(editbox1,'string',num2str(ROI_1mean));
0388          set(editbox2,'string',num2str(ROI_1std));
0389          set(editbox3,'string',num2str(image(pos(1,2),pos(1,1))));
0390          set(editbox4,'string',num2str(ROI_1min));
0391          set(editbox5,'string',num2str(ROI_1max));
0392          set(editbox6,'string',num2str(ROI_1sum));
0393          set(editbox7,'string',num2str(ROI_1no));
0394          set(editbox8,'string',num2str(ROI_1percent));
0395       else   % single pixel
0396          h2=line(x,y);
0397          set(h2,'color','g');
0398          %%% Check if pixel is already selected %%%
0399          if ~isempty(ROI_1),
0400             a=find(pos(1,1)==ROI_1(:,2));
0401             b=find(pos(1,2)==ROI_1(:,3));
0402             if isempty(a),
0403                ROI_1=[ROI_1;image(pos(1,2),pos(1,1)) pos(1,1) pos(1,2)];
0404             elseif isempty(b),
0405                ROI_1=[ROI_1;image(pos(1,2),pos(1,1)) pos(1,1) pos(1,2)];
0406             else
0407                c=0;
0408                for n=1:length(a),
0409                   if find(a(n)==b(:)),
0410                      c=a(n);
0411                   end
0412                end
0413                if c==0,
0414                   ROI_1=[ROI_1;image(pos(1,2),pos(1,1)) pos(1,1) pos(1,2)];
0415                end
0416             end
0417          else
0418             ROI_1=[ROI_1;image(pos(1,2),pos(1,1)) pos(1,1) pos(1,2)];
0419          end
0420          %%% End of Check ... %%%
0421          ROI_1mean=mean(ROI_1(:,1));
0422          ROI_1std=std(ROI_1(:,1));
0423          ROI_1min=min(ROI_1(:,1));
0424          ROI_1max=max(ROI_1(:,1));
0425          ROI_1sum=sum(ROI_1(:,1));
0426          [ROI_1no,n]=size(ROI_1);
0427          ROI_1percent=(ROI_1sum./Jtotal).*100;
0428          set(editbox1,'string',num2str(ROI_1mean));
0429          set(editbox2,'string',num2str(ROI_1std));
0430          set(editbox3,'string',num2str(image(pos(1,2),pos(1,1))));
0431          set(editbox4,'string',num2str(ROI_1min));
0432          set(editbox5,'string',num2str(ROI_1max));
0433          set(editbox6,'string',num2str(ROI_1sum));
0434          set(editbox7,'string',num2str(ROI_1no));
0435          set(editbox8,'string',num2str(ROI_1percent));
0436       end
0437    else   % Clear
0438       pix=image(pos(1,2),pos(1,1));
0439       color=round(((pix+Jmax)./(2.*Jmax)).*128);
0440       if color>128,
0441          color=128;
0442       elseif color<1,
0443          color=1;
0444       end
0445       if(get(rad2,'value')),  % Clear Big Block
0446          h3=line(x,y);
0447          set(h3,'color',doublemap(color,:));
0448          %%% Remove a pixel from ROI list %%%
0449          a=find(pos(1,1)==ROI_1(:,2));
0450          b=find(pos(1,2)==ROI_1(:,3));
0451          if ~isempty(a) & ~isempty(b),
0452             c=0;
0453             for n=1:length(a),
0454                if find(a(n)==b(:)),
0455                   c=a(n);
0456                end
0457             end
0458             if c,
0459                d=size(ROI_1);
0460                ROI_1(c,1:3)=ROI_1(d(1),1:3);
0461                ROI_1=ROI_1(1:(d(1)-1),:);
0462             end
0463          end
0464          %%% End of Remove ... %%%
0465          h3=line(x,y-1);
0466          pix=image(pos(1,2)-1,pos(1,1));
0467          color=round(((pix+Jmax)./(2.*Jmax)).*128);
0468          if color>128,
0469             color=128;
0470          elseif color<1,
0471             color=1;
0472          end
0473          set(h3,'color',doublemap(color,:));
0474          %%% Remove a pixel from ROI list %%%
0475          a=find(pos(1,1)==ROI_1(:,2));
0476          b=find(pos(1,2)-1==ROI_1(:,3));
0477          if ~isempty(a) & ~isempty(b),
0478             c=0;
0479             for n=1:length(a),
0480                if find(a(n)==b(:)),
0481                   c=a(n);
0482                end
0483             end
0484             if c,
0485                d=size(ROI_1);
0486                ROI_1(c,1:3)=ROI_1(d(1),1:3);
0487                ROI_1=ROI_1(1:(d(1)-1),:);
0488             end
0489          end
0490          %%% End of Remove ... %%%
0491          h3=line(x+1,y-1);
0492          pix=image(pos(1,2)-1,pos(1,1)+1);
0493          color=round(((pix+Jmax)./(2.*Jmax)).*128);
0494          if color>128,
0495             color=128;
0496          elseif color<1,
0497             color=1;
0498          end
0499          set(h3,'color',doublemap(color,:));
0500          %%% Remove a pixel from ROI list %%%
0501          a=find(pos(1,1)+1==ROI_1(:,2));
0502          b=find(pos(1,2)-1==ROI_1(:,3));
0503          if ~isempty(a) & ~isempty(b),
0504             c=0;
0505             for n=1:length(a),
0506                if find(a(n)==b(:)),
0507                   c=a(n);
0508                end
0509             end
0510             if c,
0511                d=size(ROI_1);
0512                ROI_1(c,1:3)=ROI_1(d(1),1:3);
0513                ROI_1=ROI_1(1:(d(1)-1),:);
0514             end
0515          end
0516          %%% End of Remove ... %%%
0517          h3=line(x-1,y);
0518          pix=image(pos(1,2),pos(1,1)-1);
0519          color=round(((pix+Jmax)./(2.*Jmax)).*128);
0520          if color>128,
0521             color=128;
0522          elseif color<1,
0523             color=1;
0524          end
0525          set(h3,'color',doublemap(color,:));
0526          %%% Remove a pixel from ROI list %%%
0527          a=find(pos(1,1)-1==ROI_1(:,2));
0528          b=find(pos(1,2)==ROI_1(:,3));
0529          if ~isempty(a) & ~isempty(b),
0530             c=0;
0531             for n=1:length(a),
0532                if find(a(n)==b(:)),
0533                   c=a(n);
0534                end
0535             end
0536             if c,
0537                d=size(ROI_1);
0538                ROI_1(c,1:3)=ROI_1(d(1),1:3);
0539                ROI_1=ROI_1(1:(d(1)-1),:);
0540             end
0541          end
0542          %%% End of Remove ... %%%
0543          h3=line(x+1,y);
0544          pix=image(pos(1,2),pos(1,1)+1);
0545          color=round(((pix+Jmax)./(2.*Jmax)).*128);
0546          if color>128,
0547             color=128;
0548          elseif color<1,
0549             color=1;
0550          end
0551          set(h3,'color',doublemap(color,:));
0552          %%% Remove a pixel from ROI list %%%
0553          a=find(pos(1,1)+1==ROI_1(:,2));
0554          b=find(pos(1,2)==ROI_1(:,3));
0555          if ~isempty(a) & ~isempty(b),
0556             c=0;
0557             for n=1:length(a),
0558                if find(a(n)==b(:)),
0559                   c=a(n);
0560                end
0561             end
0562             if c,
0563                d=size(ROI_1);
0564                ROI_1(c,1:3)=ROI_1(d(1),1:3);
0565                ROI_1=ROI_1(1:(d(1)-1),:);
0566             end
0567          end
0568          %%% End of Remove ... %%%
0569          h3=line(x-1,y+1);
0570          pix=image(pos(1,2)+1,pos(1,1)-1);
0571          color=round(((pix+Jmax)./(2.*Jmax)).*128);
0572          if color>128,
0573             color=128;
0574          elseif color<1,
0575             color=1;
0576          end
0577          set(h3,'color',doublemap(color,:));
0578          %%% Remove a pixel from ROI list %%%
0579          a=find(pos(1,1)-1==ROI_1(:,2));
0580          b=find(pos(1,2)+1==ROI_1(:,3));
0581          if ~isempty(a) & ~isempty(b),
0582             c=0;
0583             for n=1:length(a),
0584                if find(a(n)==b(:)),
0585                   c=a(n);
0586                end
0587             end
0588             if c,
0589                d=size(ROI_1);
0590                ROI_1(c,1:3)=ROI_1(d(1),1:3);
0591                ROI_1=ROI_1(1:(d(1)-1),:);
0592             end
0593          end
0594          %%% End of Remove ... %%%
0595          h3=line(x,y+1);
0596          pix=image(pos(1,2)+1,pos(1,1));
0597          color=round(((pix+Jmax)./(2.*Jmax)).*128);
0598          if color>128,
0599             color=128;
0600          elseif color<1,
0601             color=1;
0602          end
0603          set(h3,'color',doublemap(color,:));
0604          %%% Remove a pixel from ROI list %%%
0605          a=find(pos(1,1)==ROI_1(:,2));
0606          b=find(pos(1,2)+1==ROI_1(:,3));
0607          if ~isempty(a) & ~isempty(b),
0608             c=0;
0609             for n=1:length(a),
0610                if find(a(n)==b(:)),
0611                   c=a(n);
0612                end
0613             end
0614             if c,
0615                d=size(ROI_1);
0616                ROI_1(c,1:3)=ROI_1(d(1),1:3);
0617                ROI_1=ROI_1(1:(d(1)-1),:);
0618             end
0619          end
0620          %%% End of Remove ... %%%
0621          h3=line(x+1,y+1);
0622          pix=image(pos(1,2)+1,pos(1,1)+1);
0623          color=round(((pix+Jmax)./(2.*Jmax)).*128);
0624          if color>128,
0625             color=128;
0626          elseif color<1,
0627             color=1;
0628          end
0629          set(h3,'color',doublemap(color,:));
0630          %%% Remove a pixel from ROI list %%%
0631          a=find(pos(1,1)+1==ROI_1(:,2));
0632          b=find(pos(1,2)+1==ROI_1(:,3));
0633          if ~isempty(a) & ~isempty(b),
0634             c=0;
0635             for n=1:length(a),
0636                if find(a(n)==b(:)),
0637                   c=a(n);
0638                end
0639             end
0640             if c,
0641                d=size(ROI_1);
0642                ROI_1(c,1:3)=ROI_1(d(1),1:3);
0643                ROI_1=ROI_1(1:(d(1)-1),:);
0644             end
0645          end
0646          %%% End of Remove ... %%%
0647          h3=line(x-1,y-1);
0648          pix=image(pos(1,2)-1,pos(1,1)-1);
0649          color=round(((pix+Jmax)./(2.*Jmax)).*128);
0650          if color>128,
0651             color=128;
0652          elseif color<1,
0653             color=1;
0654          end
0655          set(h3,'color',doublemap(color,:));
0656          %%% Remove a pixel from ROI list %%%
0657          a=find(pos(1,1)-1==ROI_1(:,2));
0658          b=find(pos(1,2)-1==ROI_1(:,3));
0659          if ~isempty(a) & ~isempty(b),
0660             c=0;
0661             for n=1:length(a),
0662                if find(a(n)==b(:)),
0663                   c=a(n);
0664                end
0665             end
0666             if c,
0667                d=size(ROI_1);
0668                ROI_1(c,1:3)=ROI_1(d(1),1:3);
0669                ROI_1=ROI_1(1:(d(1)-1),:);
0670             end
0671          end
0672          %%% End of Remove ... %%%
0673          ROI_1mean=mean(ROI_1(:,1));
0674          ROI_1std=std(ROI_1(:,1));
0675          ROI_1min=min(ROI_1(:,1));
0676          ROI_1max=max(ROI_1(:,1));
0677          ROI_1sum=sum(ROI_1(:,1));
0678          [ROI_1no,n]=size(ROI_1);
0679          ROI_1percent=(ROI_1sum./Jtotal).*100;
0680          set(editbox1,'string',num2str(ROI_1mean));
0681          set(editbox2,'string',num2str(ROI_1std));
0682          set(editbox3,'string',num2str(image(pos(1,2),pos(1,1))));
0683          set(editbox4,'string',num2str(ROI_1min));
0684          set(editbox5,'string',num2str(ROI_1max));
0685          set(editbox6,'string',num2str(ROI_1sum));
0686          set(editbox7,'string',num2str(ROI_1no));
0687          set(editbox8,'string',num2str(ROI_1percent));
0688       else  % Clear single pixel
0689          h2=line(x,y);
0690          set(h2,'color',doublemap(color,:));
0691          %%% Remove a pixel from ROI list %%%
0692          a=find(pos(1,1)==ROI_1(:,2));
0693          b=find(pos(1,2)==ROI_1(:,3));
0694          if ~isempty(a) & ~isempty(b),
0695             c=0;
0696             for n=1:length(a),
0697                if find(a(n)==b(:)),
0698                   c=a(n);
0699                end
0700             end
0701             if c,
0702                d=size(ROI_1);
0703                ROI_1(c,1:3)=ROI_1(d(1),1:3);
0704                ROI_1=ROI_1(1:(d(1)-1),:);
0705             end
0706          end
0707          %%% End of Remove ... %%%
0708          ROI_1mean=mean(ROI_1(:,1));
0709          ROI_1std=std(ROI_1(:,1));
0710          ROI_1min=min(ROI_1(:,1));
0711          ROI_1max=max(ROI_1(:,1));
0712          ROI_1sum=sum(ROI_1(:,1));
0713          [ROI_1no,n]=size(ROI_1);
0714          ROI_1percent=(ROI_1sum./Jtotal).*100;
0715          set(editbox1,'string',num2str(ROI_1mean));
0716          set(editbox2,'string',num2str(ROI_1std));
0717          set(editbox3,'string',num2str(image(pos(1,2),pos(1,1))));
0718          set(editbox4,'string',num2str(ROI_1min));
0719          set(editbox5,'string',num2str(ROI_1max));
0720          set(editbox6,'string',num2str(ROI_1sum));
0721          set(editbox7,'string',num2str(ROI_1no));
0722          set(editbox8,'string',num2str(ROI_1percent));
0723       end
0724    end
0725 elseif selection==2,
0726    if(get(rad3,'value')),
0727       zoom
0728    else
0729       zoom off
0730    end
0731 end

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003