Changeset 133 for aedes.m


Ignore:
Timestamp:
Jun 24, 2010, 2:26:19 PM (9 years ago)
Author:
tjniskan
Message:
  • Fixed the Matlab version detection bug
  • Added zoom function to mouse wheel
  • Fixed a bug in contrast auto-balancing

M aedes_getmatlabversion.m
M aedes_resviewer.m
M aedes.m
M aedes_res2table.m
M aedes_revision.m
M aedes_juigetfiles.m

File:
1 edited

Legend:

Unmodified
Added
Removed
  • aedes.m

    r132 r133  
    320320             'CloseRequestFcn',@l_quit,...
    321321             'Handlevisibility','off');
     322if Dat.MatlabVersion>=7.05
     323  set(H.FIG,'WindowScrollWheelFcn',@l_MouseWheelFcn)
     324end
     325
    322326
    323327% File Uimenu ---------------------------
     
    10241028
    10251029% If JavaFigures are enabled, set image sliders to work while moving
    1026 if Dat.MatlabVersion>7.3
     1030if Dat.MatlabVersion>7.03
    10271031  SliderListener1 = handle.listener(H.IMSLIDER(1),...
    10281032        'ActionEvent',...
     
    11111115
    11121116% If JavaFigures are enabled, set slider to work while moving
    1113 if Dat.MatlabVersion>7.3
     1117if Dat.MatlabVersion>7.03
    11141118  SliderListener = handle.listener(H.SL_SLIDER,...
    11151119        'ActionEvent',...
     
    13361340               'string','Gamma (0.01 - 4.99)');
    13371341
    1338 if Dat.MatlabVersion>7.3
     1342if Dat.MatlabVersion>7.03
    13391343  ContrastSliderListener = handle.listener(H.CONTRAST_SLIDER,...
    13401344          'ActionEvent',@l_SetContrastBrightnessGamma);
     
    43784382 
    43794383  % Suppress warning from get(fh,'javaFrame') generated in Matlab R2008a->
    4380   if Dat.MatlabVersion>=7.6
     4384  if Dat.MatlabVersion>=7.06
    43814385    warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
    43824386  end
     
    59365940 
    59375941  % Suppress warning from get(fh,'javaFrame') generated in Matlab R2008a->
    5938   if Dat.MatlabVersion>=7.6
     5942  if Dat.MatlabVersion>=7.06
    59395943    warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
    59405944  end
     
    71357139    % Calculate contrast value and to two decimals
    71367140    Dat.Contrast=(diff(clim_in)/diff(Dat.OrigClim(Dat.DataInd,:)))*100;
    7137     Dat.Contrast = fix(Dat.Contrast*100)/100;
     7141    %Dat.Contrast = fix(Dat.Contrast*100)/100;
    71387142   
    71397143    % Calculate Brightness
    71407144    Dat.Brightness = ((diff(clim_in)/2-(diff(Dat.OrigClim(Dat.DataInd,:))/2))./(diff(Dat.OrigClim(Dat.DataInd,:))/2))*100;
    7141     Dat.Brightness = fix(Dat.Brightness*100)/100;
     7145    %Dat.Brightness = fix(Dat.Brightness*100)/100;
    71427146   
    71437147    % Make sure that contrast/brightness values are valid
     
    73167320Clim = zeros(1,2);
    73177321
    7318 if Dat.isDataMixed
    7319   max_val = max(max(DATA{Dat.DataInd}.FTDATA(:,:,:,Dat.CurrentVol)));
    7320  
     7322tmp_data = DATA{Dat.DataInd}.FTDATA(:,:,:,Dat.CurrentVol);
     7323max_val = max(tmp_data(:));
     7324 
     7325if any(strcmpi(class(DATA{Dat.DataInd}.FTDATA),{'single','double'}))
    73217326  % Saturate 1% of the low and high values
    7322   normClim = stretchlim(single(DATA{Dat.DataInd}.FTDATA(:,:,:,Dat.CurrentVol))./ ...
    7323     single(max_val),[0.005 0.995]);
    7324  
     7327  normClim = stretchlim(tmp_data./max_val,...
     7328    [0.005 0.995]);
     7329  normClim = max(normClim,[],2);
     7330  if max_val<1
     7331    Clim(1) = max_val*normClim(1);
     7332    Clim(2) = max_val*normClim(2);
     7333  else
     7334    Clim(1) = fix(max_val*normClim(1)*100)/100;
     7335    Clim(2) = fix(max_val*normClim(2)*100)/100;
     7336  end
    73257337else
    7326   % Find the minimum values of all slices in the current volume
    7327   %min_val = squeeze(min(min(DATA{Dat.DataInd}.FTDATA(:,:,:,Dat.CurrentVol))))
    7328 
    7329   % Find the maximum values of all slices in the current volume
    7330   %max_val = squeeze(max(max(DATA{Dat.DataInd}.FTDATA(:,:,:,Dat.CurrentVol))));
    7331  
    7332   tmp = DATA{Dat.DataInd}.FTDATA(:,:,:,Dat.CurrentVol);
    7333   max_val = max(tmp(:));
    7334  
    7335  
    7336   %Clim(1) = median(min_val);
    7337   %Clim(2) = median(max_val);
    7338   if any(strcmpi(class(DATA{Dat.DataInd}.FTDATA),{'single','double'}))
    7339     normClim = stretchlim(DATA{Dat.DataInd}.FTDATA(:,:,:,Dat.CurrentVol)./max_val,...
    7340       [0.005 0.995]);
    7341     normClim = max(normClim,[],2);
    7342     if max_val<1
    7343       Clim(1) = max_val*normClim(1);
    7344       Clim(2) = max_val*normClim(2);
    7345     else
    7346       Clim(1) = fix(max_val*normClim(1)*100)/100;
    7347       Clim(2) = fix(max_val*normClim(2)*100)/100;
    7348     end
    7349   else
    7350     normClim = stretchlim(DATA{Dat.DataInd}.FTDATA(:,:,:,Dat.CurrentVol),...
    7351       [0.005 0.995]);
    7352     normClim = max(normClim,[],2);
    7353     Clim(1) = floor(max_val*normClim(1));
    7354     Clim(2) = ceil(max_val*normClim(2));
    7355   end
    7356  
    7357 end
    7358 
     7338  % Saturate 1% of the low and high values
     7339  normClim = stretchlim(tmp_data,...
     7340    [0.005 0.995]);
     7341  normClim = max(normClim,[],2);
     7342  Clim(1) = floor(max_val*normClim(1));
     7343  Clim(2) = ceil(max_val*normClim(2));
     7344end
    73597345
    73607346% Update contrast
     
    98459831end % function l_SetMouseGestures(h,
    98469832
     9833%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     9834%
     9835% Mouse wheel callback
     9836%
     9837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     9838  function l_MouseWheelFcn(h,evd)
     9839   
     9840    %cp=get(H.FIG,'CurrentPoint')
     9841   
     9842    if Dat.ZoomLevel==0
     9843      l_Zoom([],[],'normalize')
     9844    end
     9845   
     9846    if evd.VerticalScrollCount<0
     9847      l_Zoom([],[],'+')
     9848    else
     9849      l_Zoom([],[],'-')
     9850    end
     9851   
     9852  end
     9853
    98479854%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    98489855%%
Note: See TracChangeset for help on using the changeset viewer.

Powered by Trac 1.0.9.Copyright © Juha-Pekka Niskanen 2008