Changeset 133


Ignore:
Timestamp:
Jun 24, 2010, 2:26:19 PM (7 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

Files:
6 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%%
  • aedes_getmatlabversion.m

    r131 r133  
    3232
    3333version_str = version;
    34 ind = strfind(version_str,'.');
    35 version_number = str2num(version_str(1:ind(2)-1));
     34ind = find(version_str=='.');
     35major_ver = str2double(version_str(1:ind(1)-1));
     36minor_ver = str2double(version_str(ind(1)+1:ind(2)-1));
     37version_number = str2double(sprintf('%d.%02d',major_ver,minor_ver));
  • aedes_juigetfiles.m

    r131 r133  
    111111%% Disable warnings about deprecated functions in Matlab R2008a->
    112112version_number = aedes_getmatlabversion;
    113 if version_number>=7.6
     113if version_number>=7.06
    114114  warning('off','MATLAB:uitree:DeprecatedFunction');
    115115  warning('off','MATLAB:uitreenode:DeprecatedFunction');
     
    559559  %% Add child nodes
    560560  version_number = aedes_getmatlabversion;
    561   if length(nodes)==1 && version_number==7.1
     561  if length(nodes)==1 && version_number==7.01
    562562    % Make nodes a JavaArray
    563563    tmpnodes = nodes;
     
    734734%% Add child nodes
    735735version_number = aedes_getmatlabversion;
    736 if length(nodes)==1 && ( version_number==7.1 | version_number==7.2)
     736if length(nodes)==1 && ( version_number==7.01 | version_number==7.02)
    737737  % Make nodes a JavaArray
    738738  tmpnodes = nodes;
     
    953953   
    954954   version_number = aedes_getmatlabversion;
    955    if length(new_nodes)==1 && version_number==7.1
     955   if length(new_nodes)==1 && version_number==7.01
    956956     % Make nodes a JavaArray
    957957     tmpnodes = new_nodes;
  • aedes_res2table.m

    r80 r133  
    208208end
    209209
     210vers = aedes_getmatlabversion;
     211if vers>=7.06
     212  % Convert empty matrices to empty strings
     213  ResTable(cellfun('isempty',ResTable))={''};
     214end
  • aedes_resviewer.m

    r132 r133  
    775775          'visible','on',...
    776776    'ColumnWidth',...
    777     {140,80,80,80,80,80,80})
     777    {140,80,80,80,80,80,80},...
     778    'ColumnFormat',repmat({'char'},1,7),...
     779    'ColumnName',[])
    778780  else
    779781        set(H.RESTABLE,'NumRows',2,...
  • aedes_revision.m

    r132 r133  
    9393% bash-script every time it is called so that this file "aedes_revision.m" is
    9494% always in the list of committed files. DO NOT EDIT THE NEXT LINE!!!
    95 % - Svn Hook -
     95% - SVN Hook -
Note: See TracChangeset for help on using the changeset viewer.

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