Changeset 131 for aedes.m


Ignore:
Timestamp:
Jun 18, 2010, 3:39:14 PM (8 years ago)
Author:
tjniskan
Message:
  • Fixed a bug in detecting Matlab version (starting from Matlab R2010a)
  • Added a function that returns a numerical Matlab (main) version (e.g. 7.6)
  • Fix contrast auto-balancing for uint8 and uint16 images (However, int16

images still behave strangely...)

A aedes_getmatlabversion.m
M aedes.m
M aedes_revision.m
M aedes_juigetfiles.m

File:
1 edited

Legend:

Unmodified
Added
Removed
  • aedes.m

    r129 r131  
    105105  l_PrintLicense([],[]);
    106106end
     107
     108% Detect Matlab version
     109Dat.MatlabVersion = aedes_getmatlabversion;
    107110
    108111
     
    10211024
    10221025% If JavaFigures are enabled, set image sliders to work while moving
    1023 matlab_version = version;
    1024 if str2num(matlab_version(1:3))>7.3
     1026if Dat.MatlabVersion>7.3
    10251027  SliderListener1 = handle.listener(H.IMSLIDER(1),...
    10261028        'ActionEvent',...
     
    11091111
    11101112% If JavaFigures are enabled, set slider to work while moving
    1111 matlab_version = version;
    1112 if str2num(matlab_version(1:3))>7.3
     1113if Dat.MatlabVersion>7.3
    11131114  SliderListener = handle.listener(H.SL_SLIDER,...
    11141115        'ActionEvent',...
     
    13351336               'string','Gamma (0.01 - 4.99)');
    13361337
    1337 if str2num(matlab_version(1:3))>7.3
     1338if Dat.MatlabVersion>7.3
    13381339  ContrastSliderListener = handle.listener(H.CONTRAST_SLIDER,...
    13391340          'ActionEvent',@l_SetContrastBrightnessGamma);
     
    43774378 
    43784379  % Suppress warning from get(fh,'javaFrame') generated in Matlab R2008a->
    4379   matlab_version = version;
    4380   matlab_version = str2num(matlab_version(1:3));
    4381   if matlab_version>=7.6
     4380  if Dat.MatlabVersion>=7.6
    43824381    warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
    43834382  end
     
    59375936 
    59385937  % Suppress warning from get(fh,'javaFrame') generated in Matlab R2008a->
    5939   matlab_version = version;
    5940   matlab_version = str2num(matlab_version(1:3));
    5941   if matlab_version>=7.6
     5938  if Dat.MatlabVersion>=7.6
    59425939    warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
    59435940  end
     
    73397336  %Clim(1) = median(min_val);
    73407337  %Clim(2) = median(max_val);
    7341   normClim = stretchlim(DATA{Dat.DataInd}.FTDATA(:,:,:,Dat.CurrentVol)./max_val,...
    7342     [0.005 0.995]);
    7343   normClim = max(normClim,[],2);
    7344 end
    7345 
    7346 %if max_val<10
    7347   Clim(1) = max_val*normClim(1);
    7348   Clim(2) = max_val*normClim(2);
    7349 %else
    7350 %  Clim(1) = floor(max_val*normClim(1));
    7351 %  Clim(2) = ceil(max_val*normClim(2));
    7352 %end
     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 
     7357end
     7358
    73537359
    73547360% Update contrast
Note: See TracChangeset for help on using the changeset viewer.

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