Changeset 131


Ignore:
Timestamp:
Jun 18, 2010, 3:39:14 PM (9 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

Files:
1 added
3 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
  • aedes_juigetfiles.m

    r96 r131  
    110110
    111111%% Disable warnings about deprecated functions in Matlab R2008a->
    112 ver = version;
    113 ver = str2num(ver(1:3));
    114 if ver>=7.6
     112version_number = aedes_getmatlabversion;
     113if version_number>=7.6
    115114  warning('off','MATLAB:uitree:DeprecatedFunction');
    116115  warning('off','MATLAB:uitreenode:DeprecatedFunction');
     
    559558 
    560559  %% Add child nodes
    561   matlab_ver = version;
    562   if length(nodes)==1 && strcmp(matlab_ver(1:3),'7.1')
     560  version_number = aedes_getmatlabversion;
     561  if length(nodes)==1 && version_number==7.1
    563562    % Make nodes a JavaArray
    564563    tmpnodes = nodes;
     
    734733
    735734%% Add child nodes
    736 matlab_ver = version;
    737 if length(nodes)==1 && any(strcmp(matlab_ver(1:3),{'7.1','7.2'}))
     735version_number = aedes_getmatlabversion;
     736if length(nodes)==1 && ( version_number==7.1 | version_number==7.2)
    738737  % Make nodes a JavaArray
    739738  tmpnodes = nodes;
     
    953952   
    954953   
    955    matlab_ver = version;
    956    if length(new_nodes)==1 && strcmp(matlab_ver(1:3),'7.1')
     954   version_number = aedes_getmatlabversion;
     955   if length(new_nodes)==1 && version_number==7.1
    957956     % Make nodes a JavaArray
    958957     tmpnodes = new_nodes;
  • aedes_revision.m

    r130 r131  
    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