Permalink
Browse files

Merge commit 'c0f9384f735e67db99b1e96882bac5ce69716cac'

  • Loading branch information...
2 parents 20c33ba + c0f9384 commit ea63227356a8f2a39c2ffd1deb762e5723a8e69a @Chrismarsh committed Nov 1, 2011
View
Oops, something went wrong.
@@ -1,84 +0,0 @@
-% Copyright (c) 2010, Moshe Lindner
-% All rights reserved.
-%
-% Redistribution and use in source and binary forms, with or without
-% modification, are permitted provided that the following conditions are
-% met:
-%
-% * Redistributions of source code must retain the above copyright
-% notice, this list of conditions and the following disclaimer.
-% * Redistributions in binary form must reproduce the above copyright
-% notice, this list of conditions and the following disclaimer in
-% the documentation and/or other materials provided with the distribution
-%
-% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-% POSSIBILITY OF SUCH DAMAGE.
-% Taken from
-% http://www.mathworks.com/matlabcentral/fileexchange/28766-animated-gif-creator
-
-% This program creates a movie/slideshow from a set of images, and save it as an animated GIF file.
-% Notice that the quality an image may decrease due to the GIF format.
-%
-% Written by Moshe Lindner , Bar-Ilan University, Israel.
-% September 2010 (C)
-
-clear all
-[file_name file_path]=uigetfile({'*.jpeg;*.jpg;*.bmp;*.tif;*.tiff;*.png;*.gif','Image Files (JPEG, BMP, TIFF, PNG and GIF)'},'Select Images','multiselect','on');
-% file_name=sort(file_name);
-[file_name2 file_path2]=uiputfile('*.gif','Save as animated GIF',file_path);
-lps=questdlg('How many loops?','Loops','Forever','None','Other','Forever');
-switch lps
- case 'Forever'
- loops=65535;
- case 'None'
- loops=1;
- case 'Other'
- loops=inputdlg('Enter number of loops? (must be an integer between 1-65535) .','Loops');
- loops=str2num(loops{1});
-end
-
-delay=inputdlg('What is the delay time? (in seconds) .','Delay');
-delay=str2num(delay{1});
-dly=questdlg('Different delay for the first image?','Delay','Yes','No','No');
-if strcmp(dly,'Yes')
- delay1=inputdlg('What is the delay time for the first image? (in seconds) .','Delay');
- delay1=str2num(delay1{1});
-else
- delay1=delay;
-end
-dly=questdlg('Different delay for the last image?','Delay','Yes','No','No');
-if strcmp(dly,'Yes')
- delay2=inputdlg('What is the delay time for the last image? (in seconds) .','Delay');
- delay2=str2num(delay2{1});
-else
- delay2=delay;
-end
-
-h = waitbar(0,['0% done'],'name','Progress') ;
-for i=1:length(file_name)
- if strcmpi('gif',file_name{i}(end-2:end))
- [M c_map]=imread([file_path,file_name{i}]);
- else
- a=imread([file_path,file_name{i}]);
- [M c_map]= rgb2ind(a,256);
- end
- if i==1
- imwrite(M,c_map,[file_path2,file_name2],'gif','LoopCount',loops,'DelayTime',delay1)
- elseif i==length(file_name)
- imwrite(M,c_map,[file_path2,file_name2],'gif','WriteMode','append','DelayTime',delay2)
- else
- imwrite(M,c_map,[file_path2,file_name2],'gif','WriteMode','append','DelayTime',delay)
- end
- waitbar(i/length(file_name),h,[num2str(round(100*i/length(file_name))),'% done']) ;
-end
-close(h);
-msgbox('Finished Successfully!')
View
@@ -1,55 +0,0 @@
-% Copyright (c) 2011, Chris Marsh
-% All rights reserved.
-%
-% Redistribution and use in source and binary forms, with or without
-% modification, are permitted provided that the following conditions are
-% met:
-%
-% * Redistributions of source code must retain the above copyright
-% notice, this list of conditions and the following disclaimer.
-% * Redistributions in binary form must reproduce the above copyright
-% notice, this list of conditions and the following disclaimer in
-% the documentation and/or other materials provided with the distribution
-% * Neither the name of the University of Saskatchewan nor the names
-% of its contributors may be used to endorse or promote products derived
-% from this software without specific prior written permission.
-%
-% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-% POSSIBILITY OF SUCH DAMAGE.
-
-
-% inside = 1 denotes the point (px,py) is inside rect
-% inside = 0 denotes the point is on a rectangle line
-% inside = -1 point is outside
-function [ inside ] = inRect( Rect, px, py )
-
-inside=1;
- for i=1:4
- y=py;
- x=px;
- x0=Rect.vertex(i,1);
- y0=Rect.vertex(i,2);
- x1=Rect.vertex(i+1,1);
- y1=Rect.vertex(i+1,2);
-
- pt = ((y - y0)*(x1 - x0) - (x - x0)*(y1 - y0));
- if pt < 0
- inside = -1;
- break;
- else if pt ==0
- inside =0;
- break;
- end
- end
- end
-end
-
View
@@ -1,193 +0,0 @@
-% Copyright (c) 2009, urs (us) schwarz
-% All rights reserved.
-%
-% Redistribution and use in source and binary forms, with or without
-% modification, are permitted provided that the following conditions are
-% met:
-%
-% * Redistributions of source code must retain the above copyright
-% notice, this list of conditions and the following disclaimer.
-% * Redistributions in binary form must reproduce the above copyright
-% notice, this list of conditions and the following disclaimer in
-% the documentation and/or other materials provided with the distribution
-%
-% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-% POSSIBILITY OF SUCH DAMAGE.
-
-% Taken from
-% http://www.mathworks.com/matlabcentral/fileexchange/3218-mtit-a-pedestria
-% n-major-title-creator
-
-%MTIT creates a major title in a figure with many axes
-%
-% MTIT
-% - creates a major title above all
-% axes in a figure
-% - preserves the stack order of
-% the axis handles
-%
-%SYNTAX
-%-------------------------------------------------------------------------------
-% P = MTIT(TXT,[OPT1,...,OPTn])
-% P = MTIT(FH,TXT,[OPT1,...,OPTn])
-%
-%INPUT
-%-------------------------------------------------------------------------------
-% FH : a valid figure handle [def: gcf]
-% TXT : title string
-%
-% OPT : argument
-% -------------------------------------------
-% xoff : +/- displacement along X axis
-% yoff : +/- displacement along Y axis
-% zoff : +/- displacement along Z axis
-%
-% title modifier pair(s)
-% -------------------------------------------
-% TPx : TVx
-% see: get(text) for possible
-% parameters/values
-%
-%OUTPUT
-%-------------------------------------------------------------------------------
-% par : parameter structure
-% .pos : position of surrounding axis
-% .oh : handle of last used axis
-% .ah : handle of invisible surrounding axis
-% .th : handle of main title
-%
-%EXAMPLE
-%-------------------------------------------------------------------------------
-% subplot(2,3,[1 3]); title('PLOT 1');
-% subplot(2,3,4); title('PLOT 2');
-% subplot(2,3,5); title('PLOT 3');
-% axes('units','inches',...
-% 'color',[0 1 .5],...
-% 'position',[.5 .5 2 2]); title('PLOT 41');
-% axes('units','inches',...
-% 'color',[0 .5 1],...
-% 'position',[3.5 .5 2 2]); title('PLOT 42');
-% shg;
-% p=mtit('the BIG title',...
-% 'fontsize',14,'color',[1 0 0],...
-% 'xoff',-.1,'yoff',.025);
-% % refine title using its handle <p.th>
-% set(p.th,'edgecolor',.5*[1 1 1]);
-
-% created:
-% us 24-Feb-2003 / R13
-% modified:
-% us 24-Feb-2003 / CSSM
-% us 06-Apr-2003 / TMW
-% us 13-Nov-2009 17:38:17
-
-%-------------------------------------------------------------------------------
-function par=mtit(varargin)
-
- defunit='normalized';
- if nargout
- par=[];
- end
-
-% check input
- if nargin < 1
- help(mfilename);
- return;
- end
- if isempty(get(0,'currentfigure'))
- disp('MTIT> no figure');
- return;
- end
-
- vl=true(size(varargin));
- if ischar(varargin{1})
- vl(1)=false;
- figh=gcf;
- txt=varargin{1};
- elseif any(ishandle(varargin{1}(:))) &&...
- ischar(varargin{2})
- vl(1:2)=false;
- figh=varargin{1};
- txt=varargin{2};
- else
- error('MTIT> invalid input');
- end
- vin=varargin(vl);
- [off,vout]=get_off(vin{:});
-
-% find surrounding box
- ah=findall(figh,'type','axes');
- if isempty(ah)
- disp('MTIT> no axis');
- return;
- end
- oah=ah(1);
-
- ou=get(ah,'units');
- set(ah,'units',defunit);
- ap=get(ah,'position');
- if iscell(ap)
- ap=cell2mat(get(ah,'position'));
- end
- ap=[ min(ap(:,1)),max(ap(:,1)+ap(:,3)),...
- min(ap(:,2)),max(ap(:,2)+ap(:,4))];
- ap=[ ap(1),ap(3),...
- ap(2)-ap(1),ap(4)-ap(3)];
-
-% create axis...
- xh=axes('position',ap);
-% ...and title
- th=title(txt,vout{:});
- tp=get(th,'position');
- set(th,'position',tp+off);
- set(xh,'visible','off','hittest','on');
- set(th,'visible','on');
-
-% reset original units
- ix=find(~strcmpi(ou,defunit));
- if ~isempty(ix)
- for i=ix(:).'
- set(ah(i),'units',ou{i});
- end
- end
-
-% ...and axis' order
- uistack(xh,'bottom');
- axes(oah); %#ok
-
- if nargout
- par.pos=ap;
- par.oh=oah;
- par.ah=xh;
- par.th=th;
- end
-end
-%-------------------------------------------------------------------------------
-function [off,vout]=get_off(varargin)
-
-% search for pairs <.off>/<value>
-
- off=zeros(1,3);
- io=0;
- for mode={'xoff','yoff','zoff'};
- ix=strcmpi(varargin,mode);
- if any(ix)
- io=io+1;
- yx=find(ix);
- ix(yx+1)=1;
- off(1,io)=varargin{yx(end)+1};
- varargin=varargin(xor(ix,1));
- end
- end
- vout=varargin;
-end
-%-------------------------------------------------------------------------------
Oops, something went wrong.

0 comments on commit ea63227

Please sign in to comment.