ToolBag file level help
C:\Users\AB\DArT_Toolshed\ToolBag\AlgPicker
AlgPicker.m
Hanna, 2005
DArT_Toolshed_Contents.m
C:\Users\AB\DArT_Toolshed\ToolBag\Demo of JRK GUI
GuiDemo.m
C:\Users\AB\DArT_Toolshed\ToolBag\FEMGrowthTool
FEMGrowthTool.m
function FEMGrowthTool(varargin) Examples: FEMGrowthTool; FEMGrowthTool('growth_filename', 'Data/a.mat'); Dr. A. I. Hanna (2007)
C:\Users\AB\DArT_Toolshed\ToolBag\FEMViewer
FEMViewer.m
function FEMViewer(varargin) A very simple FEM visualization tool. Dr. A. I. Hanna CMP, UEA, 2006.
test_femlib.m
C:\Users\AB\DArT_Toolshed\ToolBag\ImageCompositer
ImageCompositer.m
Hi! I am a simple image utility made for Sam Fox and her GFP/Confocal microscope images. I work with Matlab version 2007a but not 2007b as there seems to be some compatibility issues (probably with roipoly+handles). I was created initially using GUIDE (as evidenced below) but unfortunately my creator had a 'falling-out' with GUIDE halfway through making me, are no longer on speaking terms and wrote some of me manually. As a result, I contain some ugly program code and should not be used as good example of working matlab. I also don't contain much error handling or code comments I am very sorry and feel ashamed but.. ...I DO work as I am supposed too!! Please don't hate me because I am ugly, as that is not nice... IMAGECOMPOSITER M-file for ImageCompositer.fig IMAGECOMPOSITER, by itself, creates a new IMAGECOMPOSITER or raises the existing singleton*. H = IMAGECOMPOSITER returns the handle to a new IMAGECOMPOSITER or the handle to the existing singleton*. IMAGECOMPOSITER('CALLBACK',hObject,eventData,handles,...) calls the local function named CALLBACK in IMAGECOMPOSITER.M with the given input arguments. IMAGECOMPOSITER('Property','Value',...) creates a new IMAGECOMPOSITER or raises the existing singleton*. Starting from the left, property value pairs are applied to the GUI before ImageCompositer_OpeningFcn gets called. An unrecognized property name or invalid value makes property application stop. All inputs are passed to ImageCompositer_OpeningFcn via varargin. *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one instance to run (singleton)". See also: GUIDE, GUIDATA, GUIHANDLES
imoverlay.m
IMOVERLAY Create a mask-based image overlay. OUT = IMOVERLAY(IN, MASK, COLOR) takes an input image, IN, and a binary image, MASK, and produces an output image whose pixels in the MASK locations have the specified COLOR. IN should be a grayscale or an RGB image of class uint8, uint16, int16, logical, double, or single. If IN is double or single, it should be in the range [0, 1]. If it is not in that range, you might want to use mat2gray to scale it into that range. MASK should be a two-dimensional logical matrix. COLOR should be a 1-by-3 vector of values in the range [0, 1]. [0 0 0] is black, and [1 1 1] is white. OUT is a uint8 RGB image. Examples -------- Overlay edge detection result in green over the original image. I = imread('cameraman.tif'); bw = edge(I, 'canny'); rgb = imoverlay(I, bw, [0 1 0]); imshow(rgb) Treating the output of peaks as an image, overlay the values greater than 7 in red. The output of peaks is not in the usual grayscale image range of [0, 1], so use mat2gray to scale it. I = peaks; mask = I > 7; rgb = imoverlay(mat2gray(I), mask, [1 0 0]); imshow(rgb, 'InitialMagnification', 'fit')
C:\Users\AB\DArT_Toolshed\ToolBag\ImageReScaler
ImageReScaler.m
C:\Users\AB\DArT_Toolshed\ToolBag\LeicaScript
LeciaScript.m
C:\Users\AB\DArT_Toolshed\ToolBag\MakeTestShapes
MakeTestShapes.m
MakeTestShapesReadMeanShape.m
runMakeTestShapes.m
% project vars
C:\Users\AB\DArT_Toolshed\ToolBag\ReactionDiffusionTool
C:\Users\AB\DArT_Toolshed\ToolBag\ReactionDiffusionTool\AnisotropicReactionDiffusion
conditions.m
diffuse_chem.m
function chem = diffuse_chem(chem, diffRate, consumeRate, dt) So we can do this is several ways, we have chosen to take the convolution route. Recall that using del2 divides by 4, so we had better do the same to the convolution mask. The second reason for doing it this way is that we can plug in specific values to obtain anisotropic diffusion. Dr. A. I. Hanna (2006).
run_anisotropic_example.m
function run_anisotropic_example A simple script to show anisotropic reaction diffusion Needs to be put into a tool or toolbox but the methods are all here Dr. A. I. Hanna, CMP, 2008.
C:\Users\AB\DArT_Toolshed\ToolBag\ReactionDiffusionTool\ParamFiles
ReactionDiffusionTool.m
function ReactionDiffusionTool A small application to simulate isotropic reaction-diffusion. Usage: ReactionDiffusionTool; Dr. A. I. Hanna, CMP, 2005
C:\Users\AB\DArT_Toolshed\ToolBag\RecursivelyFindDependencies
deppkg.m
deppkg(SRC, DEST, IS_recursive) Input Parameters: SRC {str}(n) : Source m-file script/function to parse DEST {srt}(m) : Destination directory to copy dependencies to Function to find and consolidate all file dependencies for an m-file script/function or all such files in a given directory Anything that falls under the matlab root path will be ommitted (e.g. toolboxes, and standard functions). Jit Sarkar MPL/SIO 2011/04/20 Copy_List = deppkg(SRC,DEST) Output Parameters: Copy_List {cell}{str}(Nc) : IS_recursive is only used internally to trigger actual file copying, otherwise the recursion would copy your given SRC file(s) as well. Usage dependsOn=deppkg('GuiDemo.m','Dependencies'); % where GuiDemo is the m file being investigated and % where Dependencies is a local directory into which all the files on which % GuiDemo depends - they can then all be zipped together to produce a self % contained edifice.
myDepFun.m
Dep_List=myDepFun(name,toolbox) Tool for recursively finding what further functions a function depends on. myDepFun then creates a subdirectory of the 'toolbox' directory and copies all the 'external' functions that it finds into that directory. It also puts a copy of the full results (.mat file) into that subdirectory. WARNING: if the function depends on classfiles (in a directory with a name beginning with @) then please create a subdirectory within the directory 'toolbox' with the following form 'NAME_Dependencies_outside_TOOLBOX' and copy the classfile directories and contents directly into this new directory, e.g. AAMToolbox_Dependencies_outside_ShapeModelToolbox (This is because 'depfun' does not recognise classfile types.) name, name of function m file inside a toolbox (without the suffix) toolbox, path and name of the toolbox in which the function resides and which would normally be expected to contain all the functions needed. Functions outside the toolbox are 'external' tools all, default false and the final list excludes functions in the toolbox, if true then all functions are listed and external files are not copied into a local directory Dep_List, a list of all the external tools with their DArT_Toolshed paths Usage list=myDepFun('AAMToolbox','C:\DArT_Toolshed\Toolboxes\ShapeModelToolbox') WARNING at present this does not check each filename to see whether there is an associated compiled version, i.e. dll, mexx64 etc. To add a check would be straightforward if there is always an associated .m file J. Andrew Bangham, 2012
C:\Users\AB\DArT_Toolshed\ToolBag\SelectOrderListDlg
SelectOrderListDlg.m
SelectOrderListDlg Ordered List selection dialog box. [SELECTION,OK] = SelectOrderListDlg('ListString',S) creates a modal dialog box which allows you to select a string or multiple strings from a list. SELECTION is a cell structure of the selected strings. Inputs are in parameter,value pairs: Parameter Description 'ListString' cell array of strings for the list box. A 'Select all' button is provided in the multiple selection case. Example: d = dir; str = {d.name}; [s,v] = SelectOrderListDlg('ListString',str); Dr. A. I. Hanna (2005) CMP, UEA, 2005.
C:\Users\AB\DArT_Toolshed\ToolBag\ShapeEdgeEditor
ShapeEdgeEditor.m
function ShapeEdgeEditor(varargin) Example 1: edges = ShapeEdgeEditor; Example 2: theta = linspace(0, 2*pi, 20); x = cos(theta); y = sin(theta); edges = ShapeEdgeEditor('pts', [x(:), y(:)]); Dr. A. I. Hanna (2005) CMP, UEA, 2005.
C:\Users\AB\DArT_Toolshed\ToolBag\SieveStack
sieveStack.m
C:\Users\AB\DArT_Toolshed\ToolBag\SpatialAnnotation
AnnotateImage.m
GaussianFilter3D.m
function imout=GaussianFilter3D(imin,sigma) using 3 x 1D convolutions (or 2 x 1D for 2D image) NOTE: it pads with 0's at the boundaries imin, 2D or 3D volume input sigma, standard deviation of filter required (larger is slower, don't go above say 10) verbose, true to plot out results imout, output volume the same size as imin J.Andrew Bangham 2010 Usage GaussianFilter3D; % sigma=5. Generate an impulse response image volume and display progress im=GaussianFilter3D(im,2,false); % will replace 3D im by a volume filtered by Gaussian sigma=2
LoadMSR.m
function MSR=LoadMSR(filename,fieldgroups) filename, .msr file containing the data requestedfields, required fields {'field1','field2',...} hearder fields such as 'msr_version', MSR.objects.objectname' are included by default removeemptyfields, [true,false] default to true: remove empty fields J.Andrew Bangham, 2010
MakeIsoSurface.m
function MakeIsoSurface(args,opt) cd into the AAMToolbox project directory MakeIsoSurface('initialise',704LerNo24HASH1L1_x0p84y0p84z0p80conf'); MakeIsoSurface('initialise','ASN003_x0p61y0p61z0p86conf'); J.Andrew Bangham, 2010
ReadMSR2.m
ReadMSR2B.m
ReadSlices.m
WriteSlices.m
function WriteSlices(pathDirectory,VolumeImage,type,VolumeImageitdepth) pathDirectory,directory into which slices are to be written VolumeImage, either [x,y,[1:3],z] colour images with z slices or [x,y,z] grayscale images with z slices type, default png ('png' 'jpg') VolumeImageitdepth, default 8
gong.m
gong: sounds gong by John Gooden - The Netherlands 2007 call gong call gong(vol) call gong(vol,frq) call gong(vol,frq,dur) input arguments (optional, if 0 then default taken) vol = volume (default = 1) frq = base frequency (default = 440 Hz) dur = duration (default = 1 s)
load3D.m
function isos3=load3D(name) loads a 3D image from its slices and fits an isosurface J. Andrew Bangham, 2010;
msrread_jab.m
MSRREAD Read a MSR file (see wiki MSR_File_Specification for definition) The first argument is the filename, the return is a structure containing a transcription of the file content. Fields of the structure returned: 'version' -> String containing the version of the file 'original_filename' -> Path to the directory or file containing the original data 'scale' -> 3x1 vector (sx, sy, sz) with the scale of each component in the file (i.e. size of a voxel). After that, all coordinates are expressed in voxel. 'time' -> Time (in hours) ellapsed since some reference. Cannot exist if 'date' is present. 'date' -> [year month day hour min sec] time at which the data was acquired (timing the sample). Cannot exist if 'time' is present. 'nb_objects' -> Number of objects defined in the measure file 'objects' -> Structure in which each field correspond to an object in the file Fields defining an object: 'name' -> Name of the object (same as the name of the field in objects. 'render_type' -> Rendering type for the object. i.e. how it should be rendered. 'vertices' -> Nx3 array if the object has N vertices. Columns correspond to x,y,z 'edges' -> Ex2 array of integers for E edges. Columns are source and target of the edge. 'edges_shape' -> Ex1 structure with these fields: 'type' -> Defines how the edge shape is defined. 'spec' -> Specification of the shape, if needed. For type=POLYLINE spec is a nx3 array with each line being a point defining the polyline. Start and end points are not specified as they are the vertices of the edge. 'edges_growth' -> Structure with one element per growth interval. 'dt' -> Interval for which this growth is computed 'growth_rates' -> Ex1 array with the linear growth rate of each edge 'faces' -> Fx1 cell array for F faces. Each cell contains the list of vertices defining the face. 'faces_normal' -> Fx3 array with the columns begin Nx, Ny and Nz, the coordinates of the normal of the face. 'faces_growth' -> Structure with one element per growth interval. 'dt' -> Interval for which this growth is computed 'growth_tensors' -> Fx5 array with the strain tensor of the face. The columns are kmax, kmin, vx, vy and vz. (vx,vy,vz) is the unit vector defining the direction of maximum growth of the face.
msrwrite_jab.m
MSRWRITE Write a MSR file (see wiki MSR_File_Specification for definition) The first argument is the filename, the second is a structure defining the MSR file. Any fields not defined below will be ignored. Fields of the MSR structure: 'originalfilename' -> Path to the directory or file containing the original data 'scale' -> 3x1 vector (sx, sy, sz) with the scale of each component in the file (i.e. size of a voxel). After that, all coordinates are expressed in voxel. 'time' -> Time (in hours) ellapsed since some reference. Cannot exist if 'date' is present. 'date' -> [year month day hour min sec] time at which the data was acquired (timing the sample). Cannot exist if 'time' is present. 'objectcount' -> Number of objects defined in the measure file 'objects' -> Structure in which each field correspond to an object in the file Fields defining an object: 'name' -> Name of the object (must be the same as the name of the field in objects). If not specified, the name in the objects field is used. 'rendertype' -> Rendering type for the object. i.e. how it should be rendered. 'vert' -> Nx3 array if the object has N vert. Columns correspond to x,y,z 'edges' -> Ex2 array of integers for E edges. Columns are source and target of the edge. 'edgeshape' -> Ex1 structure with these fields: 'type' -> Defines how the edge shape is defined. 'spec' -> Specification of the shape, if needed. For type=POLYLINE spec is a nx3 array with each line being a point defining the polyline. Start and end points are not specified as they are the vert of the edge. 'edgegrowth' -> Structure with one element per growth interval. 'dt' -> Interval for which this growth is computed 'growth_rates' -> Ex1 array with the linear growth rate of each edge 'faces' -> Fx1 cell array for F faces. Each cell contains the list of vert defining the face. 'facenormal' -> Fx3 array with the columns begin Nx, Ny and Nz, the coordinates of the normal of the face. 'facegrowth' -> Structure with one element per growth interval. 'dt' -> Interval for which this growth is computed 'growth_tensors' -> Fx5 array with the strain tensor of the face. The columns are kmax, kmin, vx, vy and vz. (vx,vy,vz) is the unit vector defining the direction of maximum growth of the face.
objdiff.m
OBJDIFF compares two objects & returns an object of the same type with just the different fields/values. OBJDIFF (unlike Matlab's SETDIFF or SETXOR) also compares structs, GUI handles, ActiveX, Matlab & Java objects, in addition to arrays & cells. OBJDIFF also allows comparison of numeric cell arrays, unlike SETDIFF/ SETXOR. It also accepts everything that SETDIFF/SETXOR accept. Syntax: [objectC,IA,IB] = objdiff (objectA, objectB, options, ...) Inputs: objectA - first object to compare objectB - second object to compare. Field order in opaque objects does not matter. Note: If objectB is not supplied, then objectA(1) is compared to objectA(2) options - optional flags as follows: 'rows' - see documentation for <a href="matlab:doc setxor">SETXOR</a> 'dontIgnoreJava' - show different instances of the same java class (default=ignore them) Outputs: objectC - object containing only the different (or new) fields, in a {old, new} pattern IA,IB - index vector into objectA,objectB such that objectC = [objectA(IA),objectB(IB)] (see SETXOR) Examples: >> objectA = struct('a',3, 'b',5, 'd',9); >> objectB = struct('a','ert', 'c',struct('t',pi), 'd',9); >> objectC = objdiff(objectA, objectB) % a=different, b=new in objectA, c=new in objectB, d=same objectC = a: {[3] 'ert'} b: {[5] {}} c: {{} [1x1 struct]} >> objectC = objdiff(java.awt.Color.red, java.awt.Color.blue) objectC = Blue: {[0] [255]} RGB: {[-65536] [-16776961]} Red: {[255] [0]} >> objectC = objdiff(0,gcf) % 0 is the root handle objectC = children: {[2x1 struct] []} handle: {[0] [1]} properties: {[1x1 struct] [1x1 struct]} type: {'root' 'figure'} >> [objectC,IA,IB] = objdiff({2,3,4,7}, {2,4,5}) objectC = 3 5 7 IA = 2 4 IB = 3 Bugs and suggestions: Please send to Yair Altman (altmany at gmail dot com) Change log: 2007-07-27: Fixed handling of identical objects per D. Gamble 2007-03-23: First version posted on <a href="http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectType=author&mfx=1&objectId=1096533#">MathWorks File Exchange</a> See also: SETDIFF, SETXOR, ISSTRUCT, ISJAVA, ISHGHANDLE, ISOBJECT, ISCELL
select3d.m
SELECT3D(H) Determines the selected point in 3-D data space. P = SELECT3D determines the point, P, in data space corresponding to the current selection position. P is a point on the first patch or surface face intersected along the selection ray. If no face is encountered along the selection ray, P returns empty. P = SELECT3D(H) constrains selection to graphics handle H and, if applicable, any of its children. H can be a figure, axes, patch, or surface object. [P V] = SELECT3D(...), V is the closest face or line vertex selected based on the figure's current object. [P V VI] = SELECT3D(...), VI is the index into the object's x,y,zdata properties corresponding to V, the closest face vertex selected. [P V VI FACEV] = SELECT3D(...), FACE is an array of vertices corresponding to the face polygon containing P and V. [P V VI FACEV FACEI] = SELECT3D(...), FACEI is the row index into the object's face array corresponding to FACE. For patch objects, the face array can be obtained by doing get(mypatch,'faces'). For surface objects, the face array can be obtained from the output of SURF2PATCH (see SURF2PATCH for more information). RESTRICTIONS: SELECT3D supports surface, patch, or line object primitives. For surface and patches, the algorithm assumes non-self-intersecting planar faces. For line objects, the algorithm always returns P as empty, and V will be the closest vertex relative to the selection point. Example: h = surf(peaks); zoom(10); disp('Click anywhere on the surface, then hit return') pause [p v vi face facei] = select3d; marker1 = line('xdata',p(1),'ydata',p(2),'zdata',p(3),'marker','o',... 'erasemode','xor','markerfacecolor','k'); marker2 = line('xdata',v(1),'ydata',v(2),'zdata',v(3),'marker','o',... 'erasemode','xor','markerfacecolor','k'); marker2 = line('erasemode','xor','xdata',face(1,:),'ydata',face(2,:),... 'zdata',face(3,:),'linewidth',10); disp(sprintf('\nYou clicked at\nX: %.2f\nY: %.2f\nZ: %.2f',p(1),p(2),p(3)')) disp(sprintf('\nThe nearest vertex is\nX: %.2f\nY: %.2f\nZ: %.2f',v(1),v(2),v(3)')) Version 1.3 11-11-04 Copyright Joe Conti 2004 Send comments to jconti@mathworks.com See also GINPUT, GCO.
tellVolViewer.m
function tellVolViewer(foldername) Pass commands to VolViewer which is running in the background on a different thread. VolViewer must be launched with instructions showing where to find the Watchme.txt file commands will be stored in foldername that is named in Watchme.txt J. Andrew Bangham, 2010
viewsieve3D.m
function YY=Viewsieve3D(pathname,filename,minvol,WatchDirectory,verbose) Use the 3D sieve to segment out a large volume object from background pathname, path to filename filename, name of directory containing stack of images minvol, the minimum volume of extrema preserved by the 3D sieve can be set to empty [] in which case the default will be estimated by analysing the image WatchDirectory, the temporary directory used to store image stack for VolViewer Verbose, default true - displays result in VolViewer which must be running separately YY, resulting uint8 volume image (also stored as an image stack in the WatchDirectory Usage Viewsieve3D(pathname,filename); J. Andrew Bangham, 2010
C:\Users\AB\DArT_Toolshed\ToolBag\StackViewer
StackViewer.m
function StackViewer(varargin) Opens and displays stacks generated by ImageJ. The stack must be in TIF format. Dr. A. I. Hanna, CMP, UEA, 2007.
C:\Users\AB\DArT_Toolshed\ToolBag\Usefull
arrow.m
ARROW Draw a line with an arrowhead. ARROW(Start,Stop) draws a line with an arrow from Start to Stop (points should be vectors of length 2 or 3, or matrices with 2 or 3 columns), and returns the graphics handle of the arrow(s). ARROW uses the mouse (click-drag) to create an arrow. ARROW DEMO & ARROW DEMO2 show 3-D & 2-D demos of the capabilities of ARROW. ARROW may be called with a normal argument list or a property-based list. ARROW(Start,Stop,Length,BaseAngle,TipAngle,Width,Page,CrossDir) is the full normal argument list, where all but the Start and Stop points are optional. If you need to specify a later argument (e.g., Page) but want default values of earlier ones (e.g., TipAngle), pass an empty matrix for the earlier ones (e.g., TipAngle=[]). ARROW('Property1',PropVal1,'Property2',PropVal2,...) creates arrows with the given properties, using default values for any unspecified or given as 'default' or NaN. Some properties used for line and patch objects are used in a modified fashion, others are passed directly to LINE, PATCH, or SET. For a detailed properties explanation, call ARROW PROPERTIES. Start The starting points. B Stop The end points. /|\ ^ Length Length of the arrowhead in pixels. /|||\ | BaseAngle Base angle in degrees (ADE). //|||\\ L| TipAngle Tip angle in degrees (ABC). ///|||\\\ e| Width Width of the base in pixels. ////|||\\\\ n| Page Use hardcopy proportions. /////|D|\\\\\ g| CrossDir Vector || to arrowhead plane. //// ||| \\\\ t| NormalDir Vector out of arrowhead plane. /// ||| \\\ h| Ends Which end has an arrowhead. //<----->|| \\ | ObjectHandles Vector of handles to update. / base ||| \ V E angle||<-------->C ARROW(H,'Prop1',PropVal1,...), where H is a |||tipangle vector of handles to previously-created arrows ||| and/or line objects, will update the previously- ||| created arrows according to the current view -->|A|<-- width and any specified properties, and will convert two-point line objects to corresponding arrows. ARROW(H) will update the arrows if the current view has changed. Root, figure, or axes handles included in H are replaced by all descendant Arrow objects. A property list can follow any specified normal argument list, e.g., ARROW([1 2 3],[0 0 0],36,'BaseAngle',60) creates an arrow from (1,2,3) to the origin, with an arrowhead of length 36 pixels and 60-degree base angle. The basic arguments or properties can generally be vectorized to create multiple arrows with the same call. This is done by passing a property with one row per arrow, or, if all arrows are to have the same property value, just one row may be specified. You may want to execute AXIS(AXIS) before calling ARROW so it doesn't change the axes on you; ARROW determines the sizes of arrow components BEFORE the arrow is plotted, so if ARROW changes axis limits, arrows may be malformed. This version of ARROW uses features of MATLAB 6.x and is incompatible with earlier MATLAB versions (ARROW for MATLAB 4.2c is available separately); some problems with perspective plots still exist.
toolSLOC.m
function [total,sloc,chars]=toolSLOC(name) count the total Source Lines Of Code (a measure of programming effort) name, the name of a directory containing a Matlab project total, total of matlab, c, c++ and python lines of code sloc.m the total number of Matlab code (.m file) lines in .m files within the directory It recurses through all subdirectories. sloc.c total of c and c++ sloc.p total of py J. Andrew Bangham, 2011
C:\Users\AB\DArT_Toolshed\ToolBag\VolViewerAPI
C:\Users\AB\DArT_Toolshed\ToolBag\VolViewerAPI\CLASSFILES
C:\Users\AB\DArT_Toolshed\ToolBag\VolViewerAPI\CLASSFILES\@VolViewer
MSRshowVOL.m
--- help for VolViewer/MSRshowVOL ---
function VOL=MSRshowVOL(VOL,MSR) use VolViewer to plot (or delete) 3D data from an MSR (shape outline) results file it saves the MSR data to a temporary file 'Temp.msr' in fullfile(VOL.PathToWatchFile,'TempVolViewerData') VOL, VolViewer object MSR, the shape information (default - select an .msr file if MSR == 1 (i.e. a scalar) then any existing MSR plot is deleted AxesH, handle to the axis in which it will be plotted J. Andrew Bangham, 2012
SelectAndShowStack.m
VolViewer.m
function VO=VolViewer(handshakeHandle,WatchFileNumber,PathToVolViewer,PathToWatchFile) VolViewer object constructor VO, a VolViewer object handshakeHandle, handle to object the colour of which will signal correct operation of VolViewer WatchFileNumber, if 0 (default) then VolViewer is not launched 1 VolViewer is launched with WatchFile1.txt 2 ... WatchFile2.txt PathToVolViewer, default is either C:\Program Files\VolViewer or the PathToVolViewer used in the previous VolViewer object (saved data file is in CLASSFILES directory containing @VolViewer) PathToWatchFile, default is either pwd (present working directory) or the PathToWatchFile used in the previous VolViewer object (saved data file is in CLASSFILES directory containing @VolViewer) It is assumed that PathTo is the path to the following files imageFiles: msrFilename: tfnFilename: slcFilename: vvrFilename: objFilename: Usage VOL=VolViewer; % create an object without launching VolViewer VOL=VolViewer(1); % create an object and launch VolViewer J.Andrew Bangham, 2012
commandsVOL.m
--- help for VolViewer/commandsVOL ---
[VOL,SoftError]=commandsVOL(VOL,varargin) Sends commands to VolViewer by writing them into the WatchFile Usage VOL=commandsVOL(VOL,'set_channels(0, 0, 0)'); J.Andrew Bangham 2012
display.m
DISPLAY Display array. DISPLAY(X) is called for the object X when the semicolon is not used to terminate a statement. For example, X = inline('sin(x)') calls DISPLAY(X) while X = inline('sin(x)'); does not. A typical implementation of DISPLAY calls DISP to do most of the work and looks as follows. Note that DISP does not display empty arrays. function display(X) if isequal(get(0,'FormatSpacing'),'compact') disp([inputname(1) ' =']); disp(X); else disp(' '); disp([inputname(1) ' =']); disp(' '); disp(X); end See also INPUTNAME, DISP, EVALC.
Overloaded methods: opaque/display sfit/display tree/display PointModelTemplate/display AAM_Element/display AAM/display avifile/display VideoReader/display cdfepoch/display inline/display timer/display serial/display ftp/display tscollection/display timeseries/display SimTimeseries/display phytree/display zpk/display tf/display ss/display realp/display pidstd/display pid/display loopswitch/display genss/display genmat/display genfrd/display daqdevice/display daqchild/display distributed/display codistributor2dbc/display codistributor1d/display codistributed/display gpuArray/display qfft/display vdspdebug/display eclipseide/display ccsrtdx/display ccsdebug/display imaqdevice/display imaqchild/display iviconfigurationstore/display icgroup/display instrument/display network/display frd/display cvtest/display cvdata/display dataset/display categorical/display vrworld/display vrnode/display vrfigure/display piecewisedistribution/display gmdistribution/display classregtree/display ProbDist/display NaiveBayes/display sym/display
Reference page in Help browser doc display
get.m
GET Get object properties. V = GET(H,'PropertyName') returns the value of the specified property for the graphics object with handle H. If H is a vector of handles, then get will return an M-by-1 cell array of values where M is equal to length(H). If 'PropertyName' is replaced by a 1-by-N or N-by-1 cell array of strings containing property names, then GET will return an M-by-N cell array of values. GET(H) displays all property names and their current values for the graphics object with handle H. V = GET(H) where H is a scalar, returns a structure where each field name is the name of a property of H and each field contains the value of that property. V = GET(0, 'Factory') V = GET(0, 'Factory<ObjectType>') V = GET(0, 'Factory<ObjectType><PropertyName>') returns for all object types the factory values of all properties which have user-settable default values. V = GET(H, 'Default') V = GET(H, 'Default<ObjectType>') V = GET(H, 'Default<ObjectType><PropertyName>') returns information about default property values (H must be scalar). 'Default' returns a list of all default property values currently set on H. 'Default<ObjectType>' returns only the defaults for properties of <ObjectType> set on H. 'Default<ObjectType><PropertyName>' returns the default value for the specific property, by searching the defaults set on H and its ancestors, until that default is found. If no default value for this property has been set on H or any ancestor of H up through the root, then the factory value for that property is returned. Defaults can not be queried on a descendant of the object, or on the object itself - for example, a value for 'DefaultAxesColor' can not be queried on an axes or an axes child, but can be queried on a figure or on the root. When using the 'Factory' or 'Default' GET, if PropertyName is omitted then the return value will take the form of a structure in which each field name is a property name and the corresponding value is the value of that property. If PropertyName is specified then a matrix or string value will be returned. See also SET, RESET, DELETE, GCF, GCA, FIGURE, AXES.
Overloaded methods: tree/get VolViewer/get PointModelTemplate/get AAM_Element/get AAM/get avifile/get scribehgobj/get scribehandle/get hgbin/get framerect/get figobj/get celltext/get cellline/get axistext/get axisobj/get axischild/get arrowline/get timer/get serial/get hgsetget/get RandStream/get COM/get tscollection/get timeseries/get phytree/get daqdevice/get daqchild/get qfft/get imaqdevice/get imaqchild/get iviconfigurationstore/get icgroup/get icdevice/get instrument/get InputOutputModel/get opcond.get dataset/get fdspec/get fdmeas/get fdline/get fdax/get vrworld/get vrnode/get vrfigure/get
Reference page in Help browser doc get
handshakeVOL.m
--- help for VolViewer/handshakeVOL ---
Reply=handshakeVOL(VOL,timeout) Sends commands 'string' to VolViewer by writing it into the WatchFile then waits for VolViewer to echo 'string' back in another file: WatchMeFile.txt VOL, a VolViewer object timeout, the length of time the function will wait for VolViewer to complete its task default is set by VOL.timeout, i.e. 30 secs. if timeout==0 then the function will not wait - it just returns with Reply=0 else timeout should be set to, say, 10 seconds (Default 30 secs) reply, if VolViewer has not replied within the specified time, Reply=false elseif VolViewer has replied, Reply=true; message, if VolViewer has not replied within the specified time, reply=timeout else message=string Usage [reply,message]=handshakeVOL(VOL); if ~handshakeVOL(VOL,10) error('VolViewer has not replied within 10 secs') end J.Andrew Bangham 2012
imshowVOL.m
--- help for VolViewer/imshowVOL ---
VOL=imshowVOL(VOL,stackDirectoryOrImageOrImage) VOL, VolViewer object stackDirectoryOrImage, either the full path to stacks OR a volume image [rows, cols, slice] J.Andrew Bangham, 2012
set.m
SET Set object properties. SET(H,'PropertyName',PropertyValue) sets the value of the specified property for the graphics object with handle H. H can be a vector of handles, in which case SET sets the properties' values for all the objects. SET(H,a) where a is a structure whose field names are object property names, sets the properties named in each field name with the values contained in the structure. SET(H,pn,pv) sets the named properties specified in the cell array of strings pn to the corresponding values in the cell array pv for all objects specified in H. The cell array pn must be 1-by-N, but the cell array pv can be M-by-N where M is equal to length(H) so that each object will be updated with a different set of values for the list of property names contained in pn. SET(H,'PropertyName1',PropertyValue1,'PropertyName2',PropertyValue2,...) sets multiple property values with a single statement. Note that it is permissible to use property/value string pairs, structures, and property/value cell array pairs in the same call to SET. A = SET(H, 'PropertyName') SET(H,'PropertyName') returns or displays the possible values for the specified property of the object with handle H. The returned array is a cell array of possible value strings or an empty cell array if the property does not have a finite set of possible string values. A = SET(H) SET(H) returns or displays all property names and their possible values for the object with handle H. The return value is a structure whose field names are the property names of H, and whose values are cell arrays of possible property values or empty cell arrays. The default value for an object property can be set on any of an object's ancestors by setting the PropertyName formed by concatenating the string 'Default', the object type, and the property name. For example, to set the default color of text objects to red in the current figure window: set(gcf,'DefaultTextColor','red') Defaults can not be set on a descendant of the object, or on the object itself - for example, a value for 'DefaultAxesColor' can not be set on an axes or an axes child, but can be set on a figure or on the root. Three strings have special meaning for PropertyValues: 'default' - use default value (from nearest ancestor) 'factory' - use factory default value 'remove' - remove default value. See also GET, RESET, DELETE, GCF, GCA, FIGURE, AXES.
Overloaded methods: BioSeq/set BioRead/set BioMap/set tree/set VolViewer/set PointModelTemplate/set AAM_Element/set AAM/set avifile/set scribehgobj/set scribehandle/set framerect/set figobj/set editrect/set editline/set celltext/set cellline/set axistext/set axisobj/set axischild/set arrowline/set timer/set serial/set hgsetget/set RandStream/set COM/set tscollection/set timeseries/set phytree/set daqdevice/set daqchild/set qfft/set imaqdevice/set imaqchild/set iviconfigurationstore/set icgroup/set icdevice/set instrument/set InputOutputModel/set DynamicSystem/set opcond.set dataset/set fdspec/set fdmeas/set fdline/set fdax/set vrworld/set vrnode/set vrfigure/set
Reference page in Help browser doc set
showImageOrMSRusingVOL.m
--- help for VolViewer/showImageOrMSRusingVOL ---
VOL=showImageOrMSRusingVOL(VOL,stackDirectory,varargin) VO, existing VolViewer object Remaining arguments are in pairs 'PathToVolViewer': default manually set the first time 'PathToWatchFile': default manually set the first time 'WatchFileNumber': default 1.00000, WARNING only GPU cards with lots of memory will actually load images into >1 at one time PathTo: by default images are loaded imageFiles: by default all images in the stack are opened msrFilename: if any of these are filled, then the associated file will be loaded instead of images tfnFilename: ditto slcFilename: ditto vvrFilename: ditto objFilename: ditto Commands: default empty. Cell array of commands to be applied having loaded the image/result etc. Usage VOL=imshowVOL('PathTo',D:\Shape_T1_only\Image_data\11to14DFS\1554'); % Creates object VOL=imshowVOL('VolViewerObject',VOL, 'PathTo','D:\Shape_T1_only\Image_data\11to14DFS\1554'); % uses object J.Andrew Bangham, 2012
MSRread2Matlab.m
MSR=MSRread2Matlab(PathName,FileName) uses msrfilereader to read MSR file and then converts vertex indexing to start from 1 instead of 0 Also see MSRwriteFromMatlab(MSR,PathName,FileName); J. Andrew Bangham, 2012
MSRwriteFromMatlab.m
MSRwriteFromMatlab(MSR,PathName,FileName) uses msrfilereader to read MSR file and then converts vertex indexing to start from 1 instead of 0 Also see MSRread2Matlab(PathName,FileName); J. Andrew Bangham, 2012
ScaleVolume.m
checkForVolViewer.m
C:\Users\AB\DArT_Toolshed\ToolBag\dipum_toolbox_2.0
Contents.m
DIPUM Toolbox. Version 2.0 14-May-2009 MATLAB functions from the book Digital Image Processing Using MATLAB, by R.C. Gonzalez, R.E. Woods, and S.L. Eddins, Gatesmark Publishing, 2009. Book web site: http://www.imageprocessingplace.com Publisher web site: http://www.gatesmark.com/DIPUM2e.htm Release information. Readme - Information about current and previous versions. Image display and exploration. ice - Interactive Color Editor. rgbcube - Displays an RGB cube on the MATLAB desktop. Image file I/O movie2tifs - Creates a multiframe TIFF file from a MATLAB movie. seq2tifs - Creates a multi-frame TIFF file from a MATLAB sequence. tifs2movie - Create a MATLAB movie from a multiframe TIFF file. tifs2seq - Create a MATLAB sequence from a multi-frame TIFF file. Geometric transformations. imtransform2 - 2-D image transformation with fixed output location. pixeldup - Duplicates pixels of an image in both directions. pointgrid - Points arranged on a grid. reprotate - Rotate image repeatedly. vistform - Visualization transformation effect on set of points. Image registration. visreg - Visualize registered images. Pixel values and statistics. localmean - Computes an array of local means. statmoments - Computes statistical central moments of image histogram. Image analysis. bayesgauss - Bayes classifier for Gaussian patterns. bound2eight - Convert 4-connected boundary to 8-connected boundary. bound2four - Convert 8-connected boundary to 4-connected boundary. bound2im - Converts a boundary to an image. boundarydir - Determine the direction of a sequence of planar points. bsubsamp - Subsample a boundary. colorgrad - Computes the vector gradient of an RGB image. colorseg - Performs segmentation of a color image. connectpoly - Connects vertices of a polygon. cornerprocess - Processes the output of function cornermetric. diameter - Measure diameter and related properties of image regions. fchcode - Computes the Freeman chain code of a boundary. frdescp - Computes Fourier descriptors. ifrdescp - Computes inverse Fourier descriptors. im2minperpoly - Minimum perimeter polygon. imstack2vectors - Extracts vectors from an image stack. invmoments - Compute invariant moments of image. localthresh - Local thresholding. mahalanobis - Computes the Mahalanobis distance. movingthresh - Image segmentation using a moving average threshold. otsuthresh - Otsu's optimum threshold given a histogram. polyangles - Computes internal polygon angles. principalcomps - Principal-component vectors and related quantities. randvertex - Adds random noise to the vertices of a polygon. regiongrow - Perform segmentation by region growing. signature - Computes the signature of a boundary. specxture - Computes spectral texture of an image. splitmerge - Segment an image using a split-and-merge algorithm. statxture - Computes statistical measures of texture in an image. strsimilarity - Computes a similarity measure between two strings. x2majoraxis - Aligns coordinate x with the major axis of a region. Image compression. compare - Computes and displays the error between two matrices. cv2tifs - Decodes a TIFS2CV compressed image sequence. huff2mat - Decodes a Huffman encoded matrix. huffman - Builds a variable-length Huffman code for a symbol source. im2jpeg - Compresses an image using a JPEG approximation. im2jpeg2k - Compresses an image using a JPEG 2000 approximation. imratio - Computes the ratio of the bytes in two images/variables. jpeg2im - Decodes an IM2JPEG compressed image. jpeg2k2im - Decodes an IM2JPEG2K compressed image. lpc2mat - Decompresses a 1-D lossless predictive encoded matrix. mat2huff - Huffman encodes a matrix. mat2lpc - Compresses a matrix using 1-D lossles predictive coding. ntrop - Computes a first-order estimate of the entropy of a matrix. quantize - Quantizes the elements of a UINT8 matrix. showmo - Displays the motion vectors of a compressed image sequence. tifs2cv - Compresses a multi-frame TIFF image sequence. unravel - Decodes a variable-length bit stream. Image enhancement. adpmedian - Perform adaptive median filtering. gscale - Scales the intensity of the input image. intrans - Performs intensity (gray-level) transformations. Image noise. imnoise2 - Generates an array of random numbers with specified PDF. imnoise3 - Generates periodic noise. Linear filtering. dftfilt - Performs frequency domain filtering. spfilt - Performs linear and nonlinear spatial filtering. Linear 2-D filter design. bandfilter - Computes frequency domain band filters. cnotch - Generates circularly symmetric notch filters. hpfilter - Computes frequency domain highpass filters. lpfilter - Computes frequency domain lowpass filters. recnotch - Generates rectangular notch (axes) filters. Fuzzy logic. aggfcn - Aggregation function for a fuzzy system. approxfcn - Approximation function. bellmf - Bell-shaped membership function. defuzzify - Output of fuzzy system. fuzzyfilt - Fuzzy edge detector. fuzzysysfcn - Fuzzy system function. implfcns - Implication functions for a fuzzy system. lambdafcns - Lambda functions for a set of fuzzy rules. makefuzzyedgesys - Script to make MAT-file used by FUZZYFILT. onemf - Constant membership function (one). sigmamf - Sigma membership function. smf - S-shaped membership function. trapezmf - Trapezoidal membership function. triangmf - Triangular membership function. truncgaussmf - Truncated Gaussian membership function. zeromf - Constant membership function (zero). Morphological operations. endpoints - Computes end points of a binary image. Texture analysis. specxture - Computes spectral texture of an image. statxture - Computes statistical measures of texture in an image. Region-based processing. histroi - Computes the histogram of an ROI in an image. Wavelets. waveback - Computes inverse FWTs for multi-level decomposition. wavecopy - Fetches coefficients of a wavelet decomposition structure. wavecut - Zeroes coefficients in a wavelet decomposition structure. wavedisplay - Display wavelet decomposition coefficients. wavefast - Computes the FWT of a '3-D extended' 2-D array. wavefilter - Create wavelet decomposition and reconstruction filters. wavework - is used to edit wavelet decomposition structures. wavezero - Zeroes wavelet transform detail coefficients. Color space conversions. hsi2rgb - Converts an HSI image to RGB. rgb2hsi - Converts an RGB image to HSI. Array operations. dftuv - Computes meshgrid frequency matrices. paddedsize - Computes padded sizes useful for FFT-based filtering. Image types and type conversions. tofloat - Convert image to floating point. Miscellaneous functions. conwaylaws - Applies Conway's genetic laws to a single pixel. i2percentile - Computes a percentile given an intensity value. iseven - Determines which elements of an array are even numbers. isodd - Determines which elements of an array are odd numbers. manualhist - Generates a two-mode histogram interactively. timeit - Measure time required to run function. percentile2i - Computes an intensity value given a percentile. twomodegauss - Generates a two-mode Gaussian function.
Overloaded methods: mmreader/Contents VideoReader/Contents serial/Contents dioline/Contents digitalio/Contents daqdevice/Contents daqchild/Contents aochannel/Contents analogoutput/Contents analoginput/Contents aichannel/Contents videosource/Contents videoinput/Contents imaqdevice/Contents imaqchild/Contents visa/Contents udp/Contents tcpip/Contents iviconfigurationstore/Contents icgroup/Contents icdevice/Contents i2c/Contents gpib/Contents Bluetooth/Contents instrument/Contents
Readme.m
README file for the DIPUM Toolbox. These MATLAB functions were created for the book Digital Image Processing Using MATLAB, 2nd edition, by R.C. Gonzalez, R.E. Woods, and S.L. Eddins, Gatesmark Publishing, 2009. The functions supplement and extend the image processing functionality of MATLAB and the Image Processing Toolbox, both offered by The MathWorks. The P-code version of the DIPUM Toolbox --------------------------------------- The P-code version of the DIPUM Toolbox contains only executable MATLAB P-files. P-files may be executed as MATLAB functions just as M-files. Unlike M-files, however, neither the help text nor the source code is accessible. Complete source code listings for all functions are included in the book. The registered version of the DIPUM Toolbox ------------------------------------------- The registered version of the DIPUM Toolbox contains M-files with readable source code and help text. Users who want the M-files in electronic form may obtain, for a small fee, a password allowing them to download the registered toolbox. More information about both versions of the DIPUM Toolbox and details on how to obtain them are available at the book web site: http://www.imageprocessingplace.com/DIPUM_Toolbox_2/DIPUM_Toolbox_2.htm Requirements ------------ This release of the DIPUM Toolbox was developed and tested using the R2008b release of MATLAB and the Image Processing Toolbox. The DIPUM Toolbox is not supported for use with earlier versions of MATLAB or the Image Processing Toolbox. Most DIPUM functions require the Image Processing Toolbox. The DIPUM Toolbox works with all MATLAB platforms. It includes one MEX-file (UNRAVEL, which is used for Huffman decoding). Compiled binaries for this MEX-file are provided for all MATLAB platforms. Installation ------------ To install the DIPUM Toolbox, place the folder containing the functions on a local hard drive or a network drive accessible to your computer, and then include the folder location in the MATLAB path. To set the MATLAB path, start MATLAB and then select the File/Set Path menu item. Then select Add Folder. Use the navigation window to select the folder containing the functions. Click OK and then click Save. The functions will then be ready for use within MATLAB. Copyright --------- The DIPUM Toolbox is protected under U.S. and international copyright law. You may not transfer, publish, disclose, display, or otherwise make available either the free or the registered versions of the DIPUM Toolbox to other people. In particular, you may not place either version of the DIPUM Toolbox on an Internet site, a computer bulletin board, or an anonymous ftp directory from which it could be downloaded or copied by other people. Anyone may obtain the free version directly from the book's web site. Disclaimer of Warranty ---------------------- 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 HOLDER 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. The DIPUM Toolbox was not created by The MathWorks, nor is it supported by The MathWorks. About Version 2.0 ----------------- Release date: 14-May-2009 Version 2.0 corresponds to the second edition of Digital Image Processing Using MATLAB. NEW FUNCTIONS Version 2.0 contains many new functions: * aggfcn - Aggregation function for a fuzzy system. * approxfcn - Approximation function. * bandfilter - Computes frequency domain band filters. * bellmf - Bell-shaped membership function. * boundarydir - Determine the direction of a sequence of planar points. * cnotch - Generates circularly symmetric notch filters. * cornerprocess - Processes the output of function cornermetric. * cv2tifs - Decodes a TIFS2CV compressed image sequence. * defuzzify - Output of fuzzy system. * fuzzyfilt - Fuzzy edge detector. * fuzzysysfcn - Fuzzy system function. * i2percentile - Computes a percentile given an intensity value. * im2minperpoly - Minimum perimeter polygon. * implfcns - Implication functions for a fuzzy system. * imtransform2 - 2-D image transformation with fixed output location. * iseven - Determines which elements of an array are even numbers. * isodd - Determines which elements of an array are odd numbers. * lambdafcns - Lambda functions for a set of fuzzy rules. * localmean - Computes an array of local means. * localthresh - Local thresholding. * makefuzzyedgesys - Script to make MAT-file used by FUZZYFILT. * movie2tifs - Creates a multiframe TIFF file from a MATLAB movie. * movingthresh - Image segmentation using a moving average threshold. * ntrop - Computes a first-order estimate of the entropy of a matrix. * onemf - Constant membership function (one). * otsuthresh - Otsu's optimum threshold given a histogram. * percentile2i - Computes an intensity value given a percentile. * pointgrid - Points arranged on a grid. * principalcomps - Principal-component vectors and related quantities. * recnotch - Generates rectangular notch (axes) filters. * reprotate - Rotate image repeatedly. * seq2tifs - Creates a multi-frame TIFF file from a MATLAB sequence. * showmo - Displays the motion vectors of a compressed image sequence. * sigmamf - Sigma membership function. * smf - S-shaped membership function. * tifs2cv - Compresses a multi-frame TIFF image sequence. * tifs2movie - Create a MATLAB movie from a multiframe TIFF file. * tifs2seq - Create a MATLAB sequence from a multi-frame TIFF file. * timeit - Measure time required to run function. * tofloat - Convert image to floating point. * trapezmf - Trapezoidal membership function. * triangmf - Triangular membership function. * truncgaussmf - Truncated Gaussian membership function. * visreg - Visualize registered images. * vistform - Visualization transformation effect on set of points. * wavedisplay - Display wavelet decomposition coefficients. * zeromf - Constant membership function (zero). MODIFIED FUNCTIONS These functions that existed in the first edition of the book have new or modified behavior or syntaxes: * bound2im - Support fewer input arguments. * dftfilt - Use single precision. * dftuv - Use single precision. * endpoints - Use revised definition of end points. * im2jpeg - Support different bit depths. * imnoise3 - Fix incorrect computation. * intrans - Use single precision. * jpeg2im - Support different bit depths. * lpfilter - Use single precision. * regiongrow - Use single precision. * spfilt - Use single precision. * waveback - Support 3-D input. * wavefilter - Support 3-D input. Many DIPUM Toolbox functions were modified because of changes in MATLAB since the publication of the first edition, or were modified to clean up or simplify the code. Common changes include using && and || instead of & and |, removing unused variable assignments, reorganizing code into subfunctions, using hypot, and using bsxfun instead of repmat. Modified functions include adpmedian, bayesgauss, bound2eight, bound2im, bsubsamp, colorgrad, colorseg, covmatrix, fchcode, fwtcompare, gscale, huff2mat, huffman, ifrdescp, ifwtcompare, im2jpeg2k, imnoise2, imratio, imstack2vectors, intline, intrans, invmoments, jpeg2k2im, lpfilter, mahalanobis, mat2huff, paddedsize, polyangles, quantize, regiongrow, signature, spfilt, splitmerge, statmoments, strsimilarity, wave2gray, waveback, wavefast, wavefilter, and wavework. Function ice was modified according to the output of GUIDE in MATLAB R2008b. MEX function unravel was modified to use the latest MEX API calls and to use platform-independent typedefs. DELETED FUNCTIONS Several functions have been deleted from the DIPUM Toolbox: * boundaries - Replaced by Image Processing Toolbox function bwboundaries. * dftcorr - No longer used in the book. * entropy - Replaced by ntrop. * hough - Replaced by Image Processing Toolbox function. * houghlines - Replaced by Image Processing Toolbox function. * houghpeaks - Replaced by Image Processing Toolbox function. * houghpixels - Not used in the book. * minperpoly - Replaced by im2minperpoly. * princomp - Replaced by principalcomps. * vistformfwd - Replaced by vistform. About Version 1.1.4 ------------------- Release date: 15-July-2006 Changes: * bayesgauss: Corrected typo in help text. * ifrdescp: Corrected typo in help text. * im2jpeg: Corrected bug in end-of-block computation. * imnoise2: Corrected bug in the lognormal computation. * mahalanobis: Corrected typo in help text. * pixeldup: Corrected typo in comment. * rgb2hsi: Corrected typo in comment. About Version 1.1.3 ------------------- Release date: 15-Dec-2004 Changes: * bayesgauss: Corrected bug in the optimized version that was released in DIPUM Toolbox 1.1. About Version 1.1.2 ------------------- Release date: 04-Nov-2004 Changes: * bayesgauss: Revised help text and some comments in the code. * bsubsamp: Corrected indexing errors that occurred under some conditions. * ifrdescp: Revised help text. * imnoise3: Revised help text. * lpfilter: Removed a superfluous output variable. * statxture: Removed unnecessary brackets surrounding output variable. About Version 1.1.1 ------------------- Release date: 04-Jun-2004 Changes: * Added missing ice.fig file to toolbox distribution. About Version 1.1 ----------------- Release date: 10-Mar-2004 Changes: * Function bayesgauss was modified to improve performance. About Version 1.0 ----------------- Release date: 01-Dec-2003 This initial release of the DIPUM Toolbox coincides with the initial publication of Digital Image Processing Using MATLAB.
adpmedian.m
ADPMEDIAN Perform adaptive median filtering. F = ADPMEDIAN(G, SMAX) performs adaptive median filtering of image G. The median filter starts at size 3-by-3 and iterates up to size SMAX-by-SMAX. SMAX must be an odd integer greater than 1.
aggfcn.m
AGGFCN Aggregation function for a fuzzy system. QA = AGGFCN(Q) creates an aggregation function, QA, from a set of implication functions, Q. Q is a cell array of function handles as returned by IMPLFCNS. QA is a function handle that can be called with a single input V using the syntax: q = QA(V)
approxfcn.m
APPROXFCN Approximation function. G = APPROXFCN(F, RANGE) returns a function handle, G, that approximates the function handle F by using a lookup table. RANGE is an M-by-2 matrix specifying the input range for each of the M inputs to F.
average.m
AVERAGE Computes the average value of an array. AV = AVERAGE(A) computes the average value of input array, A, which must be a 1-D or 2-D array.
bandfilter.m
BANDFILTER Computes frequency domain band filters. Parameters used in the filter definitions (see Table 4.3 in DIPUM 2e for more details about these parameters): M: Number of rows in the filter. N: Number of columns in the filter. D0: Radius of the center of the band. W: "Width" of the band. W is the true width only for ideal filters. For the other two filters this parameter acts more like a smooth cutoff. n: Order of the Butterworth filter if one is specified. W and n interplay to determine the effective broadness of the reject or pass band. Higher values of both these parameters result in broader bands. Valid values of BAND are: 'reject' Bandreject filter. 'pass' Bandpass filter. One of these two values must be specified for BAND. H = BANDFILTER('ideal', BAND, M, N, D0, W) computes an M-by-N ideal bandpass or bandreject filter, depending on the value of BAND. H = BANDFILTER('btw', BAND, M, N, D0, W, n) computes an M-by-N Butterworth filter of order n. The filter is either bandpass or bandreject, depending on the value of BAND. The default value of n is 1. H = BANDFILTER('gaussian', BAND, M, N, D0, W) computes an M-by-N gaussian filter. The filter is either bandpass or bandreject, depending on BAND. H is of floating point class single. It is returned uncentered for consistency with filtering function dftfilt. To view H as an image or mesh plot, it should be centered using Hc = fftshift(H).
bayesgauss.m
BAYESGAUSS Bayes classifier for Gaussian patterns. D = BAYESGAUSS(X, CA, MA, P) computes the Bayes decision functions of the n-dimensional patterns in the rows of X. CA is an array of size n-by-n-by-W containing W covariance matrices of size n-by-n, where W is the number of classes. MA is an array of size n-by-W, whose columns are the corresponding mean vectors. A covariance matrix and a mean vector must be specified for each class. X is of size K-by-n, where K is the number of patterns to be classified. P is a 1-by-W array, containing the probabilities of occurrence of each class. If P is not included in the argument, the classes are assumed to be equally likely. D is a column vector of length K. Its ith element is the class number assigned to the ith vector in X during classification.
bellmf.m
BELLMF Bell-shaped membership function. MU = BELLMF(Z, A, B) computes the bell-shaped fuzzy membership function. Z is the input variable and can be a vector of any length. A and B are scalar shape parameters, ordered such that A <= B. MU = SMF(Z, A, B), Z < B MU = SMF(2*B - Z, A, B), B <= Z
bound2eight.m
BOUND2EIGHT Convert 4-connected boundary to 8-connected boundary. RC_NEW = BOUND2EIGHT(RC) converts a four-connected boundary to an eight-connected boundary. RC is a P-by-2 matrix, each row of which contains the row and column coordinates of a boundary pixel. RC must be a closed boundary; in other words, the last row of RC must equal the first row of RC. BOUND2EIGHT removes boundary pixels that are necessary for four-connectedness but not necessary for eight-connectedness. RC_NEW is a Q-by-2 matrix, where Q <= P.
bound2four.m
BOUND2FOUR Convert 8-connected boundary to 4-connected boundary. RC_NEW = BOUND2FOUR(RC) converts an eight-connected boundary to a four-connected boundary. RC is a P-by-2 matrix, each row of which contains the row and column coordinates of a boundary pixel. BOUND2FOUR inserts new boundary pixels wherever there is a diagonal connection.
bound2im.m
BOUND2IM Converts a boundary to an image. IMAGE = BOUND2IM(b) converts b, an np-by-2 array containing the integer coordinates of a boundary, into a binary image with 1s in the locations of the coordinates in b and 0s elsewhere. The height and width of the image are equal to the Mmin + H and Nmin + W, where Mmin = min(b(:,1)) - 1, N = min(b(:,2)) - 1, and H and W are the height and width of the boundary. In other words, the image created is the smallest image that will encompass the boundary while maintaining the its original coordinate values. IMAGE = BOUND2IM(b, M, N) places the boundary in a region of size M-by-N. M and N must satisfy the following conditions: M >= max(b(:,1)) - min(b(:,1)) + 1 N >= max(b(:,2)) - min(b(:,2)) + 1 Typically, M = size(f, 1) and N = size(f, 2), where f is the image from which the boundary was extracted. In this way, the coordinates of IMAGE and f are registered with respect to each other.
boundarydir.m
BOUNDARYDIR Determine the direction of a sequence of planar points. [DIR] = BOUNDARYDIR(X, Y) determines the direction of travel of a closed, nonintersecting sequence of planar points with coordinates contained in column vectors X and Y. Values of DIR are 'cw' (clockwise) and 'ccw' (counterclockwise). The direction of travel is with respect to the image coordinate system defined in Chapter 2 of the book. [DIR, X0, Y0] = BOUNDARYDIR(X, Y, ORDEROUT) determines the direction DIR of the input sequence, and also outputs the sequence with its direction of travel as specified in ORDEROUT. Valid values of this parameter as 'cw' and 'ccw'. The coordinates of the output sequence are column vectors X0 and Y0. The input sequence is assumed to be nonintersecting, and it cannot have duplicate points, with the exception of the first and last points possibly being the same, a condition often resulting from boundary-following functions, such as bwboundaries.
bsubsamp.m
BSUBSAMP Subsample a boundary. [S, SUNIT] = BSUBSAMP(B, GRIDSEP) subsamples the boundary B by assigning each of its points to the grid node to which it is closest. The grid is specified by GRIDSEP, which is the separation in pixels between the grid lines. For example, if GRIDSEP = 2, there are two pixels in between grid lines. So, for instance, the grid points in the first row would be at (1,1), (1,4), (1,6), ..., and similarly in the y direction. The value of GRIDSEP must be an integer. The boundary is specified by a set of coordinates in the form of an np-by-2 array. It is assumed that the boundary is one pixel thick and that it is ordered in a clockwise or counterclockwise sequence. Output S is the subsampled boundary. Output SUNIT is normalized so that the grid separation is unity. This is useful for obtaining the Freeman chain code of the subsampled boundary. The outputs are in the same order (clockwise or counterclockwise) as the input. There are no duplicate points in the output.
changeclass.m
CHANGECLASS changes the storage class of an image. I2 = CHANGECLASS(CLASS, I); RGB2 = CHANGECLASS(CLASS, RGB); BW2 = CHANGECLASS(CLASS, BW); X2 = CHANGECLASS(CLASS, X, 'indexed');
cnotch.m
CNOTCH Generates circularly symmetric notch filters. H = CNOTCH(TYPE, NOTCH, M, N, C, D0, n) generates a notch filter of size M-by-N. C is a K-by-2 matrix with K pairs of frequency domain coordinates (u, v) that define the centers of the filter notches (when specifying filter locations, remember that coordinates in MATLAB run from 1 to M and 1 to N). Coordinates (u, v) are specified for one notch only. The corresponding symmetric notches are generated automatically. D0 is the radius (cut-off frequency) of the notches. It can be specified as a scalar, in which case it is used in all K notch pairs, or it can be a vector of length K, containing an individual cutoff value for each notch pair. n is the order of the Butterworth filter if one is specified. Valid values of TYPE are: 'ideal' Ideal notchpass filter. n is not used. 'btw' Butterworth notchpass filter of order n. The default value of n is 1. 'gaussian' Gaussian notchpass filter. n is not used. Valid values of NOTCH are: 'reject' Notchreject filter. 'pass' Notchpass filter. One of these two values must be specified for NOTCH. H is of floating point class single. It is returned uncentered for consistency with filtering function dftfilt. To view H as an image or mesh plot, it should be centered using Hc = fftshift(H).
colorgrad.m
COLORGRAD Computes the vector gradient of an RGB image. [VG, VA, PPG] = COLORGRAD(F, T) computes the vector gradient, VG, and corresponding angle array, VA, (in radians) of RGB image F. It also computes PPG, the per-plane composite gradient obtained by summing the 2-D gradients of the individual color planes. Input T is a threshold in the range [0, 1]. If it is included in the argument list, the values of VG and PPG are thresholded by letting VG(x,y) = 0 for values <= T and VG(x,y) = VG(x,y) otherwise. Similar comments apply to PPG. If T is not included in the argument list then T is set to 0. Both output gradients are scaled to the range [0, 1].
colorseg.m
COLORSEG Performs segmentation of a color image. S = COLORSEG('EUCLIDEAN', F, T, M) performs segmentation of color image F using a Euclidean measure of similarity. M is a 1-by-3 vector representing the average color used for segmentation (this is the center of the sphere in Fig. 6.26 of DIPUM). T is the threshold against which the distances are compared. S = COLORSEG('MAHALANOBIS', F, T, M, C) performs segmentation of color image F using the Mahalanobis distance as a measure of similarity. C is the 3-by-3 covariance matrix of the sample color vectors of the class of interest. See function covmatrix for the computation of C and M. S is the segmented image (a binary matrix) in which 0s denote the background.
compare.m
COMPARE Computes and displays the error between two matrices. RMSE = COMPARE(F1, F2, SCALE) returns the root-mean-square error between inputs F1 and F2, displays a histogram of the difference, and displays a scaled difference image. When SCALE is omitted, a scale factor of 1 is used.
connectpoly.m
CONNECTPOLY Connects vertices of a polygon. C = CONNECTPOLY(X, Y) connects the points with coordinates given in X and Y with straight lines. These points are assumed to be a sequence of polygon vertices organized in the clockwise or counterclockwise direction. The output, C, is the set of points along the boundary of the polygon in the form of an nr-by-2 coordinate sequence in the same direction as the input. The last point in the sequence is equal to the first.
conwaylaws.m
CONWAYLAWS Applies Conway's genetic laws to a single pixel. OUT = CONWAYLAWS(NHOOD) applies Conway's genetic laws to a single pixel and its 3-by-3 neighborhood, NHOOD.
cornerprocess.m
CORNERPROCESS Processes the output of function cornermetric. CP = CORNERPROCESS(C, T, Q) postprocesses C, the output of function CORNERMETRIC, with the objective of reducing the number of irrelevant corner points (with respect to threshold T) and the number of multiple corners in a neighborhood of size Q-by-Q. If there are multiple corner points contained within that neighborhood, they are eroded morphologically to one corner point. A corner point is said to have been found at coordinates (I, J) if C(I,J) > T. A good practice is to normalize the values of C to the range [0 1], in im2double format before inputting C into this function. This facilitates interpretation of the results and makes thresholding more intuitive.
covmatrix.m
COVMATRIX Computes the covariance matrix and mean vector. [C, M] = COVMATRIX(X) computes the covariance matrix C and the mean vector M of a vector population organized as the rows of matrix X. This matrix is of size K-by-N, where K is the number of samples and N is their dimensionality. C is of size N-by-N and M is of size N-by-1. If the population contains a single sample, this function outputs M = X and C as an N-by-N matrix of NaN's because the definition of an unbiased estimate of the covariance matrix divides by K - 1.
cv2tifs.m
CV2TIFS Decodes a TIFS2CV compressed image sequence. Y = CV2TIFS(Y, F) decodes compressed sequence Y (a structure generated by TIFS2CV) and creates a multiframe TIFF file F. See also TIFS2CV.
defuzzify.m
DEFUZZIFY Output of fuzzy system. OUT = DEFUZZIFY(QA, VRANGE) transforms the aggregation function QA into a fuzzy result using the center-of-gravity method. QA is a function handle as returned by AGGFCN. VRANGE is a two-element vector specifying the range of input values for QA. OUT is the scalar result.
dftfilt.m
DFTFILT Performs frequency domain filtering. g = DFTFILT(f, H, CLASSOUT) filters f in the frequency domain using the filter transfer function H. The output, g, is the filtered image, which has the same size as f. Valid values of CLASSOUT are 'original' The ouput is of the same class as the input. This is the default if CLASSOUT is not included in the call. 'fltpoint' The output is floating point of class single, unless both f and H are of class double, in which case the output also is of class double. DFTFILT automatically pads f to be the same size as H. Both f and H must be real. In addition, H must be an uncentered, circularly-symmetric filter function.
dftuv.m
DFTUV Computes meshgrid frequency matrices. [U, V] = DFTUV(M, N) computes meshgrid frequency matrices U and V. U and V are useful for computing frequency-domain filter functions that can be used with DFTFILT. U and V are both M-by-N and of class single.
diameter.m
DIAMETER Measure diameter and related properties of image regions. S = DIAMETER(L) computes the diameter, the major axis endpoints, the minor axis endpoints, and the basic rectangle of each labeled region in the label matrix L. Positive integer elements of L correspond to different regions. For example, the set of elements of L equal to 1 corresponds to region 1; the set of elements of L equal to 2 corresponds to region 2; and so on. S is a structure array of length max(L(:)). The fields of the structure array include: Diameter MajorAxis MinorAxis BasicRectangle The Diameter field, a scalar, is the maximum distance between any two pixels in the corresponding region. The MajorAxis field is a 2-by-2 matrix. The rows contain the row and column coordinates for the endpoints of the major axis of the corresponding region. The MinorAxis field is a 2-by-2 matrix. The rows contain the row and column coordinates for the endpoints of the minor axis of the corresponding region. The BasicRectangle field is a 4-by-2 matrix. Each row contains the row and column coordinates of a corner of the region-enclosing rectangle defined by the major and minor axes. For more information about these measurements, see Section 11.2.1 of Digital Image Processing, by Gonzalez and Woods, 2nd edition, Prentice Hall.
endpoints.m
ENDPOINTS Computes end points of a binary image. G = ENDPOINTS(F) computes the end points of the binary image F and returns them in the binary image G.
fchcode.m
FCHCODE Computes the Freeman chain code of a boundary. C = FCHCODE(B) computes the 8-connected Freeman chain code of a set of 2-D coordinate pairs contained in B, an np-by-2 array. C is a structure with the following fields: c.fcc = Freeman chain code (1-by-np) c.diff = First difference of code c.fcc (1-by-np) c.mm = Integer of minimum magnitude from c.fcc (1-by-np) c.diffmm = First difference of code c.mm (1-by-np) c.x0y0 = Coordinates where the code starts (1-by-2) C = FCHCODE(B, CONN) produces the same outputs as above, but with the code connectivity specified in CONN. CONN can be 8 for an 8-connected chain code, or CONN can be 4 for a 4-connected chain code. Specifying CONN = 4 is valid only if the input sequence, B, contains transitions with values 0, 2, 4, and 6, exclusively. If it does not, an error is issued. See table below. C = FHCODE(B, CONN, DIR) produces the same outputs as above, but, in addition, the desired code direction is specified. Values for DIR can be: 'same' Same as the order of the sequence of points in b. This is the default. 'reverse' Outputs the code in the direction opposite to the direction of the points in B. The starting point for each DIR is the same. The elements of B are assumed to correspond to a 1-pixel-thick, fully-connected, closed boundary. B cannot contain duplicate coordinate pairs, except in the first and last positions, which is a common feature of boundary tracing programs. FREEMAN CHAIN CODE REPRESENTATION The table on the left shows the 8-connected Freeman chain codes corresponding to allowed deltax, deltay pairs. An 8-chain is converted to a 4-chain if (1) conn = 4; and (2) only transitions 0, 2, 4, and 6 occur in the 8-code. Note that dividing 0, 2, 4, and 6 by 2 produce the 4-code. See Fig. 12.2 for an explanation of the directional 4- and 8-codes. ----------------------- ---------------- deltax | deltay | 8-code corresp 4-code ----------------------- ---------------- 0 1 0 0 -1 1 1 -1 0 2 1 -1 -1 3 0 -1 4 2 1 -1 5 1 0 6 3 1 1 7 ----------------------- ---------------- The formula z = 4*(deltax + 2) + (deltay + 2) gives the following sequence corresponding to rows 1-8 in the preceding table: z = 11,7,6,5,9,13,14,15. These values can be used as indices into the table, improving the speed of computing the chain code. The preceding formula is not unique, but it is based on the smallest integers (4 and 2) that are powers of 2.
frdescp.m
FRDESCP Computes Fourier descriptors. Z = FRDESCP(S) computes the Fourier descriptors of S, which is an np-by-2 sequence of ordered coordinates describing a boundary. Due to symmetry considerations when working with inverse Fourier descriptors based on fewer than np terms, the number of points in S when computing the descriptors must be even. If the number of points is odd, FRDESCP duplicates the end point and adds it at the end of the sequence. If a different treatment is desired, the sequence must be processed externally so that it has an even number of points. See function IFRDESCP for computing the inverse descriptors.
fuzzyfilt.m
FUZZYFILT Fuzzy edge detector. G = FUZZYFILT(F) implements the rule-based fuzzy filter discussed in the "Using Fuzzy Sets for Spatial Filtering" section of Digital Image Processing Using MATLAB/2E. F and G are the input and filtered images, respectively. FUZZYFILT is implemented using precomputed fuzzy system function handle saved in the MAT-file fuzzyedgesys.mat. The M-script makefuzzyedgesys.m contains the code used to create the fuzzy system function.
fuzzysysfcn.m
FUZZYSYSFCN Fuzzy system function. F = FUZZYSYSFCN(INMF, OUTMF, VRANGE, OP) creates a fuzzy system function, F, corresponding to a set of rules and output membership functions. INMF is an M-by-N matrix of input membership function handles. M is the number of rules, and N is the number of fuzzy system inputs. OUTMF is a cell array containing output membership functions. numel(OUTMF) can be either M or M + 1. If it is M + 1, then the "extra" output membership function is used for an automatically computed "else rule." VRANGE is a two-element vector specifying the valid range of input values for the output membership functions. OP is a function handle specifying how to combine the antecedents for each rule. OP can be either @min or @max. If OP is omitted, then @min is used. The output, F, is a function handle that computes the fuzzy system's output, given a set of inputs, using the syntax: out = F(Z1, Z2, Z3, ..., ZN)
fwtcompare.m
FWTCOMPARE Compare wavedec2 and wavefast. [RATIO, MAXDIFF] = FWTCOMPARE(F, N, WNAME) compares the operation of Wavelet Toolbox function WAVEDEC2 and custom function WAVEFAST. INPUTS: F Image to be transformed. N Number of scales to compute. WNAME Wavelet to use. OUTPUTS: RATIO Execution time ratio (custom/toolbox) MAXDIFF Maximum coefficient difference.
gmean.m
GMEAN Geometric mean of columns. V = GMEAN(A) computes the geometric mean of the columns of A. V is a row vector with size(A,2) elements. Sample M-file used in Chapter 3.
gscale.m
GSCALE Scales the intensity of the input image. G = GSCALE(F, 'full8') scales the intensities of F to the full 8-bit intensity range [0, 255]. This is the default if there is only one input argument. G = GSCALE(F, 'full16') scales the intensities of F to the full 16-bit intensity range [0, 65535]. G = GSCALE(F, 'minmax', LOW, HIGH) scales the intensities of F to the range [LOW, HIGH]. These values must be provided, and they must be in the range [0, 1], independently of the class of the input. GSCALE performs any necessary scaling. If the input is of class double, and its values are not in the range [0, 1], then GSCALE scales it to this range before processing. The class of the output is the same as the class of the input.
histroi.m
HISTROI Computes the histogram of an ROI in an image. [P, NPIX] = HISTROI(F, C, R) computes the histogram, P, of a polygonal region of interest (ROI) in image F. The polygonal region is defined by the column and row coordinates of its vertices, which are specified (sequentially) in vectors C and R, respectively. All pixels of F must be >= 0. Parameter NPIX is the number of pixels in the polygonal region.
hpfilter.m
HPFILTER Computes frequency domain highpass filters. H = HPFILTER(TYPE, M, N, D0, n) creates the transfer function of a highpass filter, H, of the specified TYPE and size (M-by-N). Valid values for TYPE, D0, and n are: 'ideal' Ideal highpass filter with cutoff frequency D0. n need not be supplied. D0 must be positive. 'btw' Butterworth highpass filter of order n, and cutoff D0. The default value for n is 1.0. D0 must be positive. 'gaussian' Gaussian highpass filter with cutoff (standard deviation) D0. n need not be supplied. D0 must be positive. H is of floating point class single. It is returned uncentered for consistency with filtering function dftfilt. To view H as an image or mesh plot, it should be centered using Hc = fftshift(H).
hsi2rgb.m
HSI2RGB Converts an HSI image to RGB. RGB = HSI2RGB(HSI) converts an HSI image to RGB, where HSI is assumed to be of class double with: HSI(:, :, 1) = hue image, assumed to be in the range [0, 1] by having been divided by 2*pi. HSI(:, :, 2) = saturation image, in the range [0, 1]. HSI(:, :, 3) = intensity image, in the range [0, 1]. The components of the output image are: RGB(:, :, 1) = red. RGB(:, :, 2) = green. RGB(:, :, 3) = blue.
huff2mat.m
HUFF2MAT Decodes a Huffman encoded matrix. X = HUFF2MAT(Y) decodes a Huffman encoded structure Y with uint16 fields: Y.min Minimum value of X plus 32768 Y.size Size of X Y.hist Histogram of X Y.code Huffman code The output X is of class double. See also MAT2HUFF.
huffman.m
HUFFMAN Builds a variable-length Huffman code for a symbol source. CODE = HUFFMAN(P) returns a Huffman code as binary strings in cell array CODE for input symbol probability vector P. Each word in CODE corresponds to a symbol whose probability is at the corresponding index of P. Based on huffman5 by Sean Danaher, University of Northumbria, Newcastle UK. Available at the MATLAB Central File Exchange: Category General DSP in Signal Processing and Communications.
i2percentile.m
I2PERCENTILE Computes a percentile given an intensity value. P = I2PERCENTILE(H, I) Given an intensity value, I, and a histogram, H, this function computes the percentile, P, that I represents for the population of intensities governed by histogram H. I must be in the range [0, 1], independently of the class of the image from which the histogram was obtained. P is returned as a value in the range [0 1]. To convert it to a percentile multiply it by 100. By definition, I = 0 represents the 0th percentile and I = 1 represents 100th percentile. Example: Suppose that h is a uniform histogram of an uint8 image. Typing P = i2percentile(h, 127/255) would return P = 0.5, indicating that the input intensity is in the 50th percentile. See also function percentile2i.
ice.m
ICE Interactive Color Editor. OUT = ICE('Property Name', 'Property Value', ...) transforms an image's color components based on interactively specified mapping functions. Inputs are Property Name/Property Value pairs: Name Value ------------ ----------------------------------------------- 'image' An RGB or monochrome input image to be transformed by interactively specified mappings. 'space' The color space of the components to be modified. Possible values are 'rgb', 'cmy', 'hsi', 'hsv', 'ntsc' (or 'yiq'), 'ycbcr'. When omitted, the RGB color space is assumed. 'wait' If 'on' (the default), OUT is the mapped input image and ICE returns to the calling function or workspace when closed. If 'off', OUT is the handle of the mapped input image and ICE returns immediately. EXAMPLES: ice OR ice('wait', 'off') % Demo user interface ice('image', f) % Map RGB or mono image ice('image', f, 'space', 'hsv') % Map HSV of RGB image g = ice('image', f) % Return mapped image g = ice('image', f, 'wait', 'off'); % Return its handle ICE displays one popup menu selectable mapping function at a time. Each image component is mapped by a dedicated curve (e.g., R, G, or B) and then by an all-component curve (e.g., RGB). Each curve's control points are depicted as circles that can be moved, added, or deleted with a two- or three-button mouse: Mouse Button Editing Operation ------------ ----------------------------------------------- Left Move control point by pressing and dragging. Middle Add and position a control point by pressing and dragging. (Optionally Shift-Left) Right Delete a control point. (Optionally Control-Left) Checkboxes determine how mapping functions are computed, whether the input image and reference pseudo- and full-color bars are mapped, and the displayed reference curve information (e.g., PDF): Checkbox Function ------------ ----------------------------------------------- Smooth Checked for cubic spline (smooth curve) interpolation. If unchecked, piecewise linear. Clamp Ends Checked to force the starting and ending curve slopes in cubic spline interpolation to 0. No effect on piecewise linear. Show PDF Display probability density function(s) [i.e., histogram(s)] of the image components affected by the mapping function. Show CDF Display cumulative distributions function(s) instead of PDFs. <Note: Show PDF/CDF are mutually exclusive.> Map Image If checked, image mapping is enabled; else not. Map Bars If checked, pseudo- and full-color bar mapping is enabled; else display the unmapped bars (a gray wedge and hue wedge, respectively). Mapping functions can be initialized via pushbuttons: Button Function ------------ ----------------------------------------------- Reset Init the currently displayed mapping function and uncheck all curve parameters. Reset All Initialize all mapping functions.
ice_stand_alone.m
ICE M-file for ice.fig ICE, by itself, creates a new ICE or raises the existing singleton*. H = ICE returns the handle to a new ICE or the handle to the existing singleton*. ICE('Property','Value',...) creates a new ICE using the given property value pairs. Unrecognized properties are passed via varargin to ice_OpeningFcn. This calling syntax produces a warning when there is an existing singleton*. ICE('CALLBACK') and ICE('CALLBACK',hObject,...) call the local function named CALLBACK in ICE.M with the given input arguments. *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one instance to run (singleton)". See also: GUIDE, GUIDATA, GUIHANDLES
ifrdescp.m
IFRDESCP Computes inverse Fourier descriptors. S = IFRDESCP(Z, ND) computes the inverse Fourier descriptors of of Z, which is a sequence of Fourier descriptor obtained, for example, by using function FRDESCP. ND is the number of descriptors used to compute the inverse; ND must be an even integer no greater than length(Z), and length(Z) must be even also. If ND is omitted, it defaults to length(Z). The output, S, is matrix of size length(Z)-by-2 containing the coordinates of a closed boundary.
ifwtcompare.m
IFWTCOMPARE Compare waverec2 and waveback. [RATIO, MAXDIFF] = IFWTCOMPARE(F, N, WNAME) compares the operation of Wavelet Toolbox function WAVEREC2 and custom function WAVEBACK. INPUTS: F Image to transform and inverse transform. N Number of scales to compute. WNAME Wavelet to use. OUTPUTS: RATIO Execution time ratio (custom/toolbox). MAXDIFF Maximum generated image difference.
im2jpeg.m
IM2JPEG Compresses an image using a JPEG approximation. Y = IM2JPEG(X, QUALITY) compresses image X based on 8 x 8 DCT transforms, coefficient quantization, and Huffman symbol coding. Input BITS is the bits/pixel used for the unsigned integer input; QUALITY determines the amount of information that is lost and compression achieved. Y is an encoding structure containing fields: Y.size Size of X Y.bits Bits/pixel of X Y.numblocks Number of 8-by-8 encoded blocks Y.quality Quality factor (as percent) Y.huffman Huffman encoding structure, as returned by MAT2HUFF See also JPEG2IM.
im2jpeg2k.m
IM2JPEG2K Compresses an image using a JPEG 2000 approximation. Y = IM2JPEG2K(X, N, Q) compresses image X using an N-scale JPEG 2K wavelet transform, implicit or explicit coefficient quantization, and Huffman symbol coding augmented by zero run-length coding. If quantization vector Q contains two elements, they are assumed to be implicit quantization parameters; else, it is assumed to contain explicit subband step sizes. Y is an encoding structure containing Huffman-encoded data and additional parameters needed by JPEG2K2IM for decoding. See also JPEG2K2IM.
im2minperpoly.m
IM2MINPERPOLY Minimum perimeter polygon. [X, Y, R] = IM2MINPERPOLY(B, CELLSIZE) outputs in column vectors X and Y the coordinates of the vertices of the minimum perimeter polygon circumscribing a single binary region or a (nonintersecting) boundary contained in image B. The background in B must be 0, and the region or boundary must have values equal to 1. If instead of an image, B, a list of ordered vertices is available, link the vertices using function connectpoly and then use function bound2im to generate a binary image B containing the boundary. R is the region extracted from the image, from which the MPP will be computed (see Figs. 12.5(c) and 12.6(e)). Displaying this region is a good approach to determine interactively a satisfactory value for CELLSIZE. Parameter CELLSIZE is the size of the square cells that enclose the boundary of the region in B. The value of CELLSIZE must be a positive integer greater than 1. See Section 12.2.2 in the book for further details on this parameter, as well as a description and references for the algorithm.
imnoise2.m
IMNOISE2 Generates an array of random numbers with specified PDF. R = IMNOISE2(TYPE, M, N, A, B) generates an array, R, of size M-by-N, whose elements are random numbers of the specified TYPE with parameters A and B. If only TYPE is included in the input argument list, a single random number of the specified TYPE and default parameters shown below is generated. If only TYPE, M, and N are provided, the default parameters shown below are used. If M = N = 1, IMNOISE2 generates a single random number of the specified TYPE and parameters A and B. Valid values for TYPE and parameters A and B are: 'uniform' Uniform random numbers in the interval (A, B). The default values are (0, 1). 'gaussian' Gaussian random numbers with mean A and standard deviation B. The default values are A = 0, B = 1. 'salt & pepper' Salt and pepper numbers of amplitude 0 with probability Pa = A, and amplitude 1 with probability Pb = B. The default values are Pa = Pb = A = B = 0.05. Note that the noise has values 0 (with probability Pa = A) and 1 (with probability Pb = B), so scaling is necessary if values other than 0 and 1 are required. The noise matrix R is assigned three values. If R(x, y) = 0, the noise at (x, y) is pepper (black). If R(x, y) = 1, the noise at (x, y) is salt (white). If R(x, y) = 0.5, there is no noise assigned to coordinates (x, y). 'lognormal' Lognormal numbers with offset A and shape parameter B. The defaults are A = 1 and B = 0.25. 'rayleigh' Rayleigh noise with parameters A and B. The default values are A = 0 and B = 1. 'exponential' Exponential random numbers with parameter A. The default is A = 1. 'erlang' Erlang (gamma) random numbers with parameters A and B. B must be a positive integer. The defaults are A = 2 and B = 5. Erlang random numbers are approximated as the sum of B exponential random numbers.
imnoise3.m
IMNOISE3 Generates periodic noise. [r, R, S] = IMNOISE3(M, N, C, A, B), generates a spatial sinusoidal noise pattern, r, of size M-by-N, its Fourier transform, R, and spectrum, S. The remaining parameters are: C is a K-by-2 matrix with K pairs of frequency domain coordinates (u, v) that define the locations of impulses in the frequency domain. The locations are with respect to the frequency rectangle center at [floor(M/2) + 1, floor(N/2) + 1], where the use of function floor is necessary to guarantee that all values of (u, v) are integers, as required by all Fourier formulations in the book. The impulse locations are specified as integer increments with respect to the center. For example, if M = N = 512, then the center is at (257, 257). To specify an impulse at (280, 300) we specify the pair (23, 43); i.e., 257 + 23 = 280, and 257 + 43 = 300. Only one pair of coordinates is required for each impulse. The conjugate pairs are generated automatically. A is a 1-by-K vector that contains the amplitude of each of the K impulse pairs. If A is not included in the argument, the default used is A = ONES(1, K). B is then automatically set to its default values (see next paragraph). The value specified for A(j) is associated with the coordinates in C(j, :). B is a K-by-2 matrix containing the Bx and By phase components for each impulse pair. The default value for B is zeros(K, 2).
implfcns.m
IMPLFCNS Implication functions for a fuzzy system. Q = IMPLFCNS(L, OUTMF, Z1, Z2, ..., ZN) creates a set of implication functions from a set of lambda functions L, a set of output member functions OUTMF, and a set of fuzzy system inputs Z1, Z2, ..., ZN. L is a cell array of rule-strength function handles as returned by LAMBDAFCNS. OUTMF is a cell array of output membership functions. The number of elements of OUTMF can either be numel(L) or numel(L)+1. If numel(OUTMF) is numel(L)+1, then the "extra" membership function is applied to an automatically computed "else rule." (See Section 3.6.3.). The inputs Z1, Z2, etc., can all be scalars, or they can all be vectors of the same size (i.e., these vectors would contain multiple values for each of the inputs). Q is a 1-by-numel(OUTMF) cell array of implication function handles. Call the i-th implication function on an input V using the syntax: q_i = Q{i}(V)
improd.m
IMPROD Compute the product of two images. [P, PMAX, PMIN, PN] = IMPROD(F, G) outputs the element-by-element product of two input images, F and G, the product maximum and minimum values, and a normalized product array with values in the range [0, 1]. The input images must be of the same size. They can be of class uint8, unit16, or double. The outputs are of class double. Sample M-file used in Chapter 2.
imratio.m
IMRATIO Computes the ratio of the bytes in two images/variables. CR = IMRATIO(F1, F2) returns the ratio of the number of bytes in variables/files F1 and F2. If F1 and F2 are an original and compressed image, respectively, CR is the compression ratio.
imstack2vectors.m
IMSTACK2VECTORS Extracts vectors from an image stack. [X, R] = imstack2vectors(S, MASK) extracts vectors from S, which is an M-by-N-by-n stack array of n registered images of size M-by-N each (see Fig. 12.29). The extracted vectors are arranged as the rows of array X. Input MASK is an M-by-N logical or numeric image with nonzero values (1s if it is a logical array) in the locations where elements of S are to be used in forming X and 0s in locations to be ignored. The number of row vectors in X is equal to the number of nonzero elements of MASK. If MASK is omitted, all M*N locations are used in forming X. A simple way to obtain MASK interactively is to use function roipoly. Finally, R is a column vector that contains the linear indices of the locations of the vectors extracted from S.
imtransform2.m
IMTRANSFORM2 2-D image transformation with fixed output location G = IMTRANSFORM2(F, TFORM, ...) applies a 2-D geometric transformation to an image. IMTRANSFORM2 fixes the output image location to cover the same region as the input image. IMTRANSFORM2 takes the same set of optional parameter/value pairs as IMTRANSFORM.
intline.m
INTLINE Integer-coordinate line drawing algorithm. [X, Y] = INTLINE(X1, X2, Y1, Y2) computes an approximation to the line segment joining (X1, Y1) and (X2, Y2) with integer coordinates. X1, X2, Y1, and Y2 should be integers. INTLINE is reversible; that is, INTLINE(X1, X2, Y1, Y2) produces the same results as FLIPUD(INTLINE(X2, X1, Y2, Y1)).
intrans.m
INTRANS Performs intensity (gray-level) transformations. G = INTRANS(F, 'neg') computes the negative of input image F. G = INTRANS(F, 'log', C, CLASS) computes C*log(1 + F) and multiplies the result by (positive) constant C. If the last two parameters are omitted, C defaults to 1. Because the log is used frequently to display Fourier spectra, parameter CLASS offers the option to specify the class of the output as 'uint8' or 'uint16'. If parameter CLASS is omitted, the output is of the same class as the input. G = INTRANS(F, 'gamma', GAM) performs a gamma transformation on the input image using parameter GAM (a required input). G = INTRANS(F, 'stretch', M, E) computes a contrast-stretching transformation using the expression 1./(1 + (M./F).^E). Parameter M must be in the range [0, 1]. The default value for M is mean2(tofloat(F)), and the default value for E is 4. G = INTRANS(F, 'specified', TXFUN) performs the intensity transformation s = TXFUN(r) where r are input intensities, s are output intensities, and TXFUN is an intensity transformation (mapping) function, expressed as a vector with values in the range [0, 1]. TXFUN must have at least two values. For the 'neg', 'gamma', 'stretch' and 'specified' transformations, floating-point input images whose values are outside the range [0, 1] are scaled first using MAT2GRAY. Other images are converted to floating point using TOFLOAT. For the 'log' transformation,floating-point images are transformed without being scaled; other images are converted to floating point first using TOFLOAT. The output is of the same class as the input, except if a different class is specified for the 'log' option.
invmoments.m
INVMOMENTS Compute invariant moments of image. PHI = INVMOMENTS(F) computes the moment invariants of the image F. PHI is a seven-element row vector containing the moment invariants as defined in equations (11.3-17) through (11.3-23) of Gonzalez and Woods, Digital Image Processing, 2nd Ed. F must be a 2-D, real, nonsparse, numeric or logical matrix.
iseven.m
ISEVEN Determines which elements of an array are even numbers. E = ISEVEN(A) returns a logical array, E, of the same size as A, with 1s (TRUE) in the locations corresponding to even numbers in A, and 0s (FALSE) elsewhere.
isodd.m
ISODD Determines which elements of an array are odd numbers. D = ISODD(A) returns a logical array, D, of the same size as A, with 1s (TRUE) in the locations corresponding to odd numbers in A, and 0s (FALSE) elsewhere.
jpeg2im.m
JPEG2IM Decodes an IM2JPEG compressed image. X = JPEG2IM(Y) decodes compressed image Y, generating reconstructed approximation X. Y is a structure generated by IM2JPEG. See also IM2JPEG.
jpeg2k2im.m
JPEG2K2IM Decodes an IM2JPEG2K compressed image. X = JPEG2K2IM(Y) decodes compressed image Y, reconstructing an approximation of the original image X. Y is an encoding structure returned by IM2JPEG2K. See also IM2JPEG2K.
lambdafcns.m
LAMBDAFCNS Lambda functions for a set of fuzzy rules. L = LAMBDAFCNS(INMF, OP) creates a set of lambda functions (rule strength functions) corresponding to a set of fuzzy rules. L is a cell array of function handles. INMF is an M-by-N matrix of input membership function handles. M is the number of rules, and N is the number of fuzzy system inputs. INMF(i, j) is the input membership function applied by the i-th rule to the j-th input. For example, in the case of Fig. 3.25, INMF would be of size 3-by-2 (three rules and two inputs). OP is a function handle used to combine the antecedents for each rule. OP can be either @min or @max. If omitted, the default value for OP is @min. The output lambda functions are called later with N inputs, Z1, Z2, ..., ZN, to determine rule strength: lambda_i = L{i}(Z1, Z2, ..., ZN)
localmean.m
LOCALMEAN Computes an array of local means. MEAN = LOCALMEAN(F, NHOOD) computes the mean at the center of every neighborhood of F defined by NHOOD, an array of zeros and ones where the nonzero elements specify the neighbors used in the computation of the local means. The size of NHOOD must be odd in each dimension; the default is ones(3). Output MEAN is an array the same size as F containing the local mean at each point.
localthresh.m
LOCALTHRESH Local thresholding. G = LOCALTHRESH(F, NHOOD, A, B, MEANTYPE) thresholds image F by computing a local threshold at the center,(x, y), of every neighborhood in F. The size of the neighborhoods is defined by NHOOD, an array of zeros and ones in which the nonzero elements specify the neighbors used in the computation of the local mean and standard deviation. The size of NHOOD must be odd in both dimensions. The segmented image is given by 1 if (F > A*SIG) AND (F > B*MEAN) G = 0 otherwise where SIG is an array of the same size as F containing the local standard deviations. If MEANTYPE = 'local' (the default), then MEAN is an array of local means. If MEANTYPE = 'global', then MEAN is the global (image) mean, a scalar. Constants A and B are nonnegative scalars.
lpc2mat.m
LPC2MAT Decompresses a 1-D lossless predictive encoded matrix. X = LPC2MAT(Y, F) decodes input matrix Y based on linear prediction coefficients in F and the assumption of 1-D lossless predictive coding. If F is omitted, filter F = 1 (for previous pixel coding) is assumed. See also MAT2LPC.
lpfilter.m
LPFILTER Computes frequency domain lowpass filters. H = LPFILTER(TYPE, M, N, D0, n) creates the transfer function of a lowpass filter, H, of the specified TYPE and size (M-by-N). To view the filter as an image or mesh plot, it should be centered using H = fftshift(H). Valid values for TYPE, D0, and n are: 'ideal' Ideal lowpass filter with cutoff frequency D0. n need not be supplied. D0 must be positive. 'btw' Butterworth lowpass filter of order n, and cutoff D0. The default value for n is 1.0. D0 must be positive. 'gaussian' Gaussian lowpass filter with cutoff (standard deviation) D0. n need not be supplied. D0 must be positive. H is of floating point class single. It is returned uncentered for consistency with filtering function dftfilt. To view H as an image or mesh plot, it should be centered using Hc = fftshift(H).
mahalanobis.m
MAHALANOBIS Computes the Mahalanobis distance. D = MAHALANOBIS(Y, X) computes the Mahalanobis distance between each vector in Y to the mean (centroid) of the vectors in X, and outputs the result in vector D, whose length is size(Y, 1). The vectors in X and Y are assumed to be organized as rows. The input data can be real or complex. The outputs are real quantities. D = MAHALANOBIS(Y, CX, MX) computes the Mahalanobis distance between each vector in Y and the given mean vector, MX. The results are output in vector D, whose length is size(Y, 1). The vectors in Y are assumed to be organized as the rows of this array. The input data can be real or complex. The outputs are real quantities. In addition to the mean vector MX, the covariance matrix CX of a population of vectors X must be provided also. Use function COVMATRIX (Section 12.5) to compute MX and CX.
makefuzzyedgesys.m
MAKEFUZZYEDGESYS Script to make MAT-file used by FUZZYFILT.
manualhist.m
MANUALHIST Generates a two-mode histogram interactively. P = MANUALHIST generates a two-mode histogram using function TWOMODEGAUSS(m1, sig1, m2, sig2, A1, A2, k). m1 and m2 are the means of the two modes and must be in the range [0,1]. sig1 and sig2 are the standard deviations of the two modes. A1 and A2 are amplitude values, and k is an offset value that raises the floor of the histogram. The number of elements in the histogram vector P is 256 and sum(P) is normalized to 1. MANUALHIST repeatedly prompts for the parameters and plots the resulting histogram until the user types an 'x' to quit, and then it returns the last histogram computed. A good set of starting values is: (0.15, 0.05, 0.75, 0.05, 1, 0.07, 0.002).
mat2huff.m
MAT2HUFF Huffman encodes a matrix. Y = MAT2HUFF(X) Huffman encodes matrix X using symbol probabilities in unit-width histogram bins between X's minimum and maximum values. The encoded data is returned as a structure Y: Y.code The Huffman-encoded values of X, stored in a uint16 vector. The other fields of Y contain additional decoding information, including: Y.min The minimum value of X plus 32768 Y.size The size of X Y.hist The histogram of X If X is logical, uint8, uint16, uint32, int8, int16, or double, with integer values, it can be input directly to MAT2HUFF. The minimum value of X must be representable as an int16. If X is double with non-integer values---for example, an image with values between 0 and 1---first scale X to an appropriate integer range before the call. For example, use Y = MAT2HUFF(255*X) for 256 gray level encoding. NOTE: The number of Huffman code words is round(max(X(:))) - round(min(X(:))) + 1. You may need to scale input X to generate codes of reasonable length. The maximum row or column dimension of X is 65535. See also HUFF2MAT.
mat2lpc.m
MAT2LPC Compresses a matrix using 1-D lossles predictive coding. Y = MAT2LPC(X, F) encodes matrix X using 1-D lossless predictive coding. A linear prediction of X is made based on the coefficients in F. If F is omitted, F = 1 (for previous pixel coding) is assumed. The prediction error is then computed and output as encoded matrix Y. See also LPC2MAT.
movie2tifs.m
MOVIE2TIFS Creates a multiframe TIFF file from a MATLAB movie. MOVIE2TIFS(M, FILE) creates a multiframe TIFF file from the specified MATLAB movie structure, M.
movingthresh.m
MOVINGTHRESH Image segmentation using a moving average threshold. G = MOVINGTHRESH(F, n, K) segments image F by thresholding its intensities based on the moving average of the intensities along individual rows of the image. The average at pixel k is formed by averaging the intensities of that pixel and its n - 1 preceding neighbors. To reduce shading bias, the scanning is done in a zig-zag manner, treating the pixels as if they were a 1-D, continuous stream. If the value of the image at a point exceeds K percent of the value of the running average at that point, a 1 is output in that location in G. Otherwise a 0 is output. At the end of the procedure, G is thus the thresholded (segmented) image. K must be a scalar in the range [0, 1].
ntrop.m
NTROP Computes a first-order estimate of the entropy of a matrix. H = NTROP(X, N) returns the entropy of matrix X with N symbols. N = 256 if omitted but it must be larger than the number of unique values in X for accurate results. The estimate assumes a statistically independent source characterized by the relative frequency of occurrence of the elements in X. The estimate is a lower bound on the average number of bits per unique value (or symbol) when coding without coding redundancy.
onemf.m
ONEMF Constant membership function (one). ONEMF(Z) returns an an array of ones with the same size as Z. When using the @min operator to combine rule antecedents, associating this membership function with a particular input means that input has no effect.
otsuthresh.m
OTSUTHRESH Otsu's optimum threshold given a histogram. [T, SM] = OTSUTHRESH(H) computes an optimum threshold, T, in the range [0 1] using Otsu's method for a given a histogram, H.
paddedsize.m
PADDEDSIZE Computes padded sizes useful for FFT-based filtering. PQ = PADDEDSIZE(AB), where AB is a two-element size vector, computes the two-element size vector PQ = 2*AB. PQ = PADDEDSIZE(AB, 'PWR2') computes the vector PQ such that PQ(1) = PQ(2) = 2^nextpow2(2*m), where m is MAX(AB). PQ = PADDEDSIZE(AB, CD), where AB and CD are two-element size vectors, computes the two-element size vector PQ. The elements of PQ are the smallest even integers greater than or equal to AB + CD - 1. PQ = PADDEDSIZE(AB, CD, 'PWR2') computes the vector PQ such that PQ(1) = PQ(2) = 2^nextpow2(2*m), where m is MAX([AB CD]).
percentile2i.m
PERCENTILE2I Computes an intensity value given a percentile. I = PERCENTILE2I(H, P) Given a percentile, P, and a histogram, H, this function computes an intensity, I, representing the Pth percentile and returns the value in I. P must be in the range [0, 1] and I is returned as a value in the range [0, 1] also. Example: Suppose that h is a uniform histogram of an 8-bit image. Typing I = percentile2i(h, 0.5) would output I = 0.5. To convert to the (integer) 8-bit range [0, 255], we let I = floor(255*I). See also function i2percentile.
pixeldup.m
PIXELDUP Duplicates pixels of an image in both directions. B = PIXELDUP(A, M, N) duplicates each pixel of A M times in the vertical direction and N times in the horizontal direction. Parameters M and N must be integers. If N is not included, it defaults to M.
pointgrid.m
POINTGRID Points arranged on a grid. WZ = POINTGRID(CORNERS) computes a set point of points on a grid containing 10 horizontal and vertical lines. Each line contains 50 points. CORNERS is a 2-by-2 matrix. The first row contains the horizontal and vertical coordinates of one corner of the grid. The second row contains the coordinates of the opposite corner. Each row of the P-by-2 output matrix, WZ, contains the coordinates of a point on the output grid.
polyangles.m
POLYANGLES Computes internal polygon angles. ANGLES = POLYANGLES(X, Y) computes the interior angles (in degrees) of an arbitrary polygon whose vertices are given in [X, Y], ordered in a clockwise manner. The program eliminates duplicate adjacent rows in [X Y], except that the first row may equal the last, so that the polygon is closed.
predicate.m
PREDICATE Evaluates a predicate for function splitmerge FLAG = PREDICATE(REGION) evaluates a predicate for use in function splitmerge for Example 11.14 in Digital Image Processing Using MATLAB, 2nd edition. REGION is a subimage, and FLAG is set to TRUE if the predicate evaluates to TRUE for REGION; FLAG is set to FALSE otherwise.
principalcomps.m
PRINCIPALCOMPS Principal-component vectors and related quantities. P = PRINCIPALCOMPS(X, Q) Computes the principal-component vectors of the vector population contained in the rows of X, a matrix of size K-by-n where K (assumed to be > 1)is the number of vectors and n is their dimensionality. Q, with values in the range [0, n], is the number of eigenvectors used in constructing the principal-components transformation matrix. P is a structure with the following fields: P.Y K-by-Q matrix whose columns are the principal- component vectors. P.A Q-by-n principal components transformation matrix whose rows are the Q eigenvectors of Cx corresponding to the Q largest eigenvalues. P.X K-by-n matrix whose rows are the vectors reconstructedfrom the principal-component vectors. P.X and P.Y are identical if Q = n. P.ems The mean square error incurred in using only the Q eigenvectors corresponding to the largest eigenvalues. P.ems is 0 if Q = n. P.Cx The n-by-n covariance matrix of the population in X. P.mx The n-by-1 mean vector of the population in X. P.Cy The Q-by-Q covariance matrix of the population in Y. The main diagonal contains the eigenvalues (in descending order) corresponding to the Q eigenvectors.
quantize.m
QUANTIZE Quantizes the elements of a UINT8 matrix. Y = QUANTIZE(X, B, TYPE) quantizes X to B bits. Truncation is used unless TYPE is 'igs' for Improved Gray Scale quantization.
randvertex.m
RANDVERTEX Adds random noise to the vertices of a polygon. [XN, YN] = RANDVERTEX[X, Y, NPIX] adds uniformly distributed noise to the coordinates of vertices of a polygon. The coordinates of the vertices are input in X and Y, and NPIX is the maximum number of pixel locations by which any pair (X(i), Y(i)) is allowed to deviate. For example, if NPIX = 1, the location of any X(i) will not deviate by more than one pixel location in the x-direction, and similarly for Y(i). Noise is added independently to the two coordinates.
recnotch.m
RECNOTCH Generates rectangular notch (axes) filters. H = RECNOTCH(NOTCH, MODE, M, N, W, SV, SH) generates an M-by-N notch filter consisting of symmetric pairs of rectangles of width W placed on the vertical and horizontal axes of the (centered) frequency rectangle. The vertical rectangles start at +SV and -SV on the vertical axis and extend to both ends of the axis. Horizontal rectangles similarly start at +SH and -SH and extend to both ends of the axis. These values are with respect to the origin of the axes of the centered frequency rectangle. For example, specifying SV = 50 creates a rectangle of width W that starts 50 pixels above the center of the vertical axis and extends up to the first row of the filter. A similar rectangle is created starting 50 pixels below the center and extending to the last row. W must be an odd number to preserve the symmetry of the filtered Fourier transform. Valid values of NOTCH are: 'reject' Notchreject filter. 'pass' Notchpass filter. Valid values of MODE are: 'both' Filtering on both axes. 'horizontal' Filtering on horizontal axis only. 'vertical' Filtering on vertical axis only. One of these three values must be specified in the call. H = RECNOTCH(NOTCH, MODE, M, N) sets W = 1, and SV = SH = 1. H is of floating point class single. It is returned uncentered for consistency with filtering function dftfilt. To view H as an image or mesh plot, it should be centered using Hc = fftshift(H).
regiongrow.m
REGIONGROW Perform segmentation by region growing. [G, NR, SI, TI] = REGIONGROW(F, S, T). S can be an array (the same size as F) with a 1 at the coordinates of every seed point and 0s elsewhere. S can also be a single seed value. Similarly, T can be an array (the same size as F) containing a threshold value for each pixel in F. T can also be a scalar, in which case it becomes a global threshold. All values in S and T must be in the range [0, 1] G is the result of region growing, with each region labeled by a different integer, NR is the number of regions, SI is the final seed image used by the algorithm, and TI is the image consisting of the pixels in F that satisfied the threshold test, but before they were processed for connectivity.
reprotate.m
REPROTATE Rotate image repeatedly G = REPROTATE(F, INTERP_METHOD) rotates the input image, F, twelve times in succession as a test of different interpolation methods. INTERP_METHOD can be one of the strings 'nearest', 'bilinear', or 'bicubic'.
rgb2hsi.m
RGB2HSI Converts an RGB image to HSI. HSI = RGB2HSI(RGB) converts an RGB image to HSI. The input image is assumed to be of size M-by-N-by-3, where the third dimension accounts for three image planes: red, green, and blue, in that order. If all RGB component images are equal, the HSI conversion is undefined. The input image can be of class double (with values in the range [0, 1]), uint8, or uint16. The output image, HSI, is of class double, where: HSI(:, :, 1) = hue image normalized to the range [0, 1] by dividing all angle values by 2*pi. HSI(:, :, 2) = saturation image, in the range [0, 1]. HSI(:, :, 3) = intensity image, in the range [0, 1].
rgbcube.m
RGBCUBE Displays an RGB cube on the MATLAB desktop. RGBCUBE(VX, VY, VZ) displays an RGB color cube, viewed from point (VX, VY, VZ). With no input arguments, RGBCUBE uses (10, 10, 4) as the default viewing coordinates. To view individual color planes, use the following viewing coordinates, where the first color in the sequence is the closest to the viewing axis, and the other colors are as seen from that axis, proceeding to the right right (or above), and then moving clockwise. ------------------------------------------------- COLOR PLANE ( vx, vy, vz) ------------------------------------------------- Blue-Magenta-White-Cyan ( 0, 0, 10) Red-Yellow-White-Magenta ( 10, 0, 0) Green-Cyan-White-Yellow ( 0, 10, 0) Black-Red-Magenta-Blue ( 0, -10, 0) Black-Blue-Cyan-Green (-10, 0, 0) Black-Red-Yellow-Green ( 0, 0, -10)
seq2tifs.m
SEQ2TIFS Creates a multi-frame TIFF file from a MATLAB sequence.
showmo.m
SHOWMO Displays the motion vectors of a compressed image sequence. SHOWMO(CV, I) displayes the motion vectors for frame I of a TIFS2CV compressed sequence of images. See also TIFS2CV and CV2TIFS.
sigmamf.m
SIGMAMF Sigma membership function. MU = SIGMAMF(Z, A, B) computes the sigma fuzzy membership function. Z is the input variable and can be a vector of any length. A and B are scalar shape parameters, ordered such that A <= B. MU = 0, Z < A MU = (Z - A) ./ (B - A), A <= Z < B MU = 1, B <= Z
signature.m
SIGNATURE Computes the signature of a boundary. [DIST, ANGLE, XC, YC] = SIGNATURE(B, X0, Y0) computes the signature of a given boundary. A signature is defined as the distance from (X0, Y0) to the boundary, as a function of angle (ANGLE). B is an np-by-2 array (np > 2) containing the (x, y) coordinates of the boundary ordered in a clockwise or counterclockwise direction. If (X0, Y0) is not included in the input argument, the centroid of the boundary is used by default. The maximum size of arrays DIST and ANGLE is 360-by-1, indicating a maximum resolution of one degree. The input must be a one-pixel-thick boundary obtained, for example, by using function bwboundaries. If (X0, Y0) or the default centroid is outside the boundary, the signature is not defined and an error is issued.
smf.m
SMF S-shaped membership function. MU = SMF(Z, A, B) computes the S-shaped fuzzy membership function. Z is the input variable and can be a vector of any length. A and B are scalar shape parameters, ordered such that A <= B. MU = 0, Z < A MU = 2*((Z - A) ./ (B - A)).^2, A <= Z < P MU = 1 - 2*((Z - B) ./ (B - A)).^2, P <= Z < B MU = 1, B <= Z where P = (A + B)/2.
specxture.m
SPECXTURE Computes spectral texture of an image. [SRAD, SANG, S] = SPECXTURE(F) computes SRAD, the spectral energy distribution as a function of radius from the center of the spectrum, SANG, the spectral energy distribution as a function of angle for 0 to 180 degrees in increments of 1 degree, and S = log(1 + spectrum of f), normalized to the range [0, 1]. The maximum value of radius is min(M,N), where M and N are the number of rows and columns of image (region) f. Thus, SRAD is a row vector of length = (min(M, N)/2) - 1; and SANG is a row vector of length 180.
spfilt.m
SPFILT Performs linear and nonlinear spatial filtering. F = SPFILT(G, TYPE, M, N, PARAMETER) performs spatial filtering of image G using a TYPE filter of size M-by-N. Valid calls to SPFILT are as follows: F = SPFILT(G, 'amean', M, N) Arithmetic mean filtering. F = SPFILT(G, 'gmean', M, N) Geometric mean filtering. F = SPFILT(G, 'hmean', M, N) Harmonic mean filtering. F = SPFILT(G, 'chmean', M, N, Q) Contraharmonic mean filtering of order Q. The default Q is 1.5. F = SPFILT(G, 'median', M, N) Median filtering. F = SPFILT(G, 'max', M, N) Max filtering. F = SPFILT(G, 'min', M, N) Min filtering. F = SPFILT(G, 'midpoint', M, N) Midpoint filtering. F = SPFILT(G, 'atrimmed', M, N, D) Alpha-trimmed mean filtering. Parameter D must be a nonnegative even integer; its default value is 2. The default values when only G and TYPE are input are M = N = 3, Q = 1.5, and D = 2.
splitmerge.m
SPLITMERGE Segment an image using a split-and-merge algorithm. G = SPLITMERGE(F, MINDIM, @PREDICATE) segments image F by using a split-and-merge approach based on quadtree decomposition. MINDIM (a nonnegative integer power of 2) specifies the minimum dimension of the quadtree regions (subimages) allowed. If necessary, the program pads the input image with zeros to the nearest square size that is an integer power of 2. This guarantees that the algorithm used in the quadtree decomposition will be able to split the image down to blocks of size 1-by-1. The result is cropped back to the original size of the input image. In the output, G, each connected region is labeled with a different integer. Note that in the function call we use @PREDICATE for the value of fun. PREDICATE is a a user-defined function. Its syntax is FLAG = PREDICATE(REGION) Must return TRUE if the pixels in REGION satisfy the predicate defined in the body of the function; otherwise, the value of FLAG must be FALSE. The following simple example of function PREDICATE is used in Example 11.14 of the book. It sets FLAG to TRUE if the intensities of the pixels in REGION have a standard deviation that exceeds 10, and their mean intensity is between 0 and 125. Otherwise FLAG is set to false. function flag = predicate(region) sd = std2(region); m = mean2(region); flag = (sd > 10) & (m > 0) & (m < 125);
statmoments.m
STATMOMENTS Computes statistical central moments of image histogram. [W, UNV] = STATMOMENTS(P, N) computes up to the Nth statistical central moment of a histogram whose components are in vector P. The length of P must equal 256 or 65536. The program outputs a vector V with V(1) = mean, V(2) = variance, V(3) = 3rd moment, . . . V(N) = Nth central moment. The random variable values are normalized to the range [0, 1], so all moments also are in this range. The program also outputs a vector UNV containing the same moments as V, but using un-normalized random variable values (e.g., 0 to 255 if length(P) = 2^8). For example, if length(P) = 256 and V(1) = 0.5, then UNV(1) would have the value UNV(1) = 127.5 (half of the [0 255] range).
statxture.m
STATXTURE Computes statistical measures of texture in an image. T = STATXURE(F, SCALE) computes six measures of texture from an image (region) F. Parameter SCALE is a 6-dim row vector whose elements multiply the 6 corresponding elements of T for scaling purposes. If SCALE is not provided it defaults to all 1s. The output T is 6-by-1 vector with the following elements: T(1) = Average gray level T(2) = Average contrast T(3) = Measure of smoothness T(4) = Third moment T(5) = Measure of uniformity T(6) = Entropy
strsimilarity.m
STRSIMILARITY Computes a similarity measure between two strings. R = STRSIMILARITY(A, B) computes the similarity measure, R, defined in Section 13.4.2 for strings A and B. The strings do not have to be of the same length, but only one of the strings can have blanks, and these must be trailing blanks. Blanks are not counted when computing the length of the strings for use in the similarity measure.
subim.m
SUBIM Extract subimage. S = SUBIM(F, M, N, RX, CY) extracts a subimage, S, from the input image, F. The subimage is of size M-by-N, and the coordinates of its top, left corner are (RX, CY). Sample M-file used in Chapter 2.
tifs2cv.m
TIFS2CV Compresses a multi-frame TIFF image sequence. Y = TIFS2CV(F, M, D, Q) compresses multiframe TIFF F using motion compensated frames, 8 x 8 DCT transforms, and Huffman coding. If parameter Q is omitted or is 0, only Huffman encoding is used and the compression is lossless; for Q > 0, lossy JPEG encoding is performed. The inputs are: F A multi-frame TIFF file (e.g., 'file.tif') M Macroblock size (e.g., 8) D Search displacement (e.g., [16 8]) Q JPEG quality for IM2JPEG (e.g., 1) Output Y is an encoding structure with fields: Y.blksz Size of motion compensation blocks Y.frames The number of frames in the image sequence Y.quality The reconstruction quality Y.motion Huffman encoded motion vectors Y.video An array of MAT2HUFF or IM2JPEG coding structures See also CV2TIFS.
tifs2movie.m
TIFS2MOVIE Create a MATLAB movie from a multiframe TIFF file. M = TIFS2MOVIE(FILE) creates a MATLAB movie structure from a multiframe TIFF file.
tifs2seq.m
TIFS2SEQ Create a MATLAB sequence from a multi-frame TIFF file.
timeit.m
TIMEIT Measure time required to run function. T = TIMEIT(F) measures the time (in seconds) required to run F, which is a function handle. TIMEIT handles automatically the usual benchmarking procedures of "warming up" F, figuring out how many times to repeat F in a timing loop, etc. TIMEIT also compensates for the estimated time-measurement overhead associated with tic/toc and with calling function handles. TIMEIT returns the median of several repeated measurements. If nargout(F) == 0, TIMEIT calls F with no output arguments, like this: F() If nargout(F) > 0, TIMEIT calls F with a single output argument, like this: OUT = F() If nargout(F) < 0, which can occur when F uses varargout or is an anonymous function, TIMEIT uses try/catch to determine whether to call F with one or zero output arguments. Examples -------- How much time does it take to compute sum(A.' .* B, 1), where A is 12000-by-400 and B is 400-by-12000? A = rand(12000, 400); B = rand(400, 12000); f = @() sum(A.' .* B, 1); timeit(f) How much time does it take to dilate the text.png image with a 25-by-25 all-ones structuring element? (This example uses Image Processing Toolbox functions.) bw = imread('text.png'); se = strel(ones(25, 25)); g = @() imdilate(bw, se); timeit(g)
tofloat.m
TOFLOAT Convert image to floating point [OUT, REVERTCLASS] = TOFLOAT(IN) converts the input image IN to floating-point. If IN is a double or single image, then OUT equals IN. Otherwise, OUT equals IM2SINGLE(IN). REVERTCLASS is a function handle that can be used to convert back to the class of IN.
trapezmf.m
TRAPEZMF Trapezoidal membership function. MU = TRAPEZMF(Z, A, B, C) computes a fuzzy membership function with a trapezoidal shape. Z is the input variable and can be a vector of any length. A, B, C, and D are scalar parameters that define the trapezoidal shape. The parameters must be ordered so that A <= B, B <= C, and C <= D. MU = 0, Z < A MU = (Z - A) ./ (B - A), A <= Z < B MU = 1, B <= Z < C MU = 1 - (Z - C) ./ (D - C), C <= Z < D MU = 0, D <= Z
triangmf.m
TRIANGMF Triangular membership function. MU = TRIANGMF(Z, A, B, C) computes a fuzzy membership function with a triangular shape. Z is the input variable and can be a vector of any length. A, B, and C are scalar parameters, such that B >= A and C >= B, that define the triangular shape. MU = 0, Z < A MU = (Z - A) ./ (B - A), A <= Z < B MU = 1 - (Z - B) ./ (C - B), B <= Z < C MU = 0, C <= Z
truncgaussmf.m
TRUNCGAUSSMF Truncated Gaussian membership function. MU = TRUNCGAUSSMF(Z, A, B, S) computes a truncated Gaussian fuzzy membership function. Z is the input variable and can be a vector of any length. A, B, and S are scalar shape parameters. A and B have to be ordered such that A <= B. MU = exp(-(Z - B).^2 / s^2), abs(Z - B) <= (B - A) MU = 0, otherwise
twodsin.m
TWODSIN Compare for-loops vs. vectorization. The comparison is based on implementing the function f(x, y) = Asin(u0x + v0y) for x = 0, 1, 2,..., M - 1 and y = 0, 1, 2,..., N - 1. The inputs to the function are M and N and the constants in the function. Sample M-file used in Chapter 2.
twomodegauss.m
TWOMODEGAUSS Generates a two-mode Gaussian function. P = TWOMODEGAUSS(M1, SIG1, M2, SIG2, A1, A2, K) generates a two-mode, Gaussian-like function in the interval [0, 1]. P is a 256-element vector normalized so that SUM(P) = 1. The mean and standard deviation of the modes are (M1, SIG1) and (M2, SIG2), respectively. A1 and A2 are the amplitude values of the two modes. Since the output is normalized, only the relative values of A1 and A2 are important. K is an offset value that raises the "floor" of the function. A good set of values to try is M1 = 0.15, SIG1 = 0.05, M2 = 0.75, SIG2 = 0.05, A1 = 1, A2 = 0.07, and K = 0.002.
unravel.m
UNRAVEL Decodes a variable-length bit stream. X = UNRAVEL(Y, LINK, XLEN) decodes UINT16 input vector Y based on transition and output table LINK. The elements of Y are considered to be a contiguous stream of encoded bits--i.e., the MSB of one element follows the LSB of the previous element. Input XLEN is the number code words in Y, and thus the size of output vector X (class DOUBLE). Input LINK is a transition and output table (that drives a series of binary searches): 1. LINK(0) is the entry point for decoding, i.e., state n = 0. 2. If LINK(n) < 0, the decoded output is |LINK(n)|; set n = 0. 3. If LINK(n) > 0, get the next encoded bit and transition to state [LINK(n) - 1] if the bit is 0, else LINK(n).
visreg.m
VISREG Visualize registered images VISREG(FREF, F, TFORM) displays two registered images together. FREF is the reference image. F is the input image, and TFORM defines the geometric transformation that aligns image F with image FREF. VISREG(FREF, F, TFORM, LAYER) displays F transparently over FREF if LAYER is 'top'; otherwise it displays FREF transparently over F. VISREG(FREF, F, TFORM, LAYER, ALPHA) uses the scalar value ALPHA, which ranges between 0.0 and 1.0, to control the level of transparency of the top image. If ALPHA is 1.0, the top image is opaque. If ALPHA is 0.0, the top image is invisible. H = VISREG(...) returns a vector of handles to the two displayed image objects. H is in the form [HBOTTOM, HTOP].
vistform.m
VISTFORM Visualization transformation effect on set of points. VISTFORM(TFORM, WZ) shows two plots. On the left are the points in each row of the P-by-2 matrix WZ. On the right are the spatially transformed points using TFORM.
wave2gray.m
WAVE2GRAY Display wavelet decomposition coefficients. W = WAVE2GRAY(C, S, SCALE, BORDER) displays and returns a wavelet coefficient image. EXAMPLES: wave2gray(c, s); Display w/defaults. foo = wave2gray(c, s); Display and return. foo = wave2gray(c, s, 4); Magnify the details. foo = wave2gray(c, s, -4); Magnify absolute values. foo = wave2gray(c, s, 1, 'append'); Keep border values. INPUTS/OUTPUTS: [C, S] is a wavelet decomposition vector and bookkeeping matrix. SCALE Detail coefficient scaling ---------------------------------------------------------- 0 or 1 Maximum range (default) 2,3... Magnify default by the scale factor -1, -2... Magnify absolute values by abs(scale) BORDER Border between wavelet decompositions ---------------------------------------------------------- 'absorb' Border replaces image (default) 'append' Border increases width of image Image W: ------- ------ ------------ ------------------- | | | | | a(n) | h(n) | | | | | | ------- ------ h(n-1) | | | | | | v(n) | d(n) | | h(n-2) | | | | ------- ------ ------------ | | | | v(n-1) | d(n-1) | | | | -------------- ------------ ------------------- | | | v(n-2) | d(n-2) | | Here, n denotes the decomposition step scale and a, h, v, d are approximation, horizontal, vertical, and diagonal detail coefficients, respectively.
waveback.m
WAVEBACK Computes inverse FWTs for multi-level decomposition [C, S]. [VARARGOUT] = WAVEBACK(C, S, VARARGIN) performs a 2D N-level partial or complete wavelet reconstruction of decomposition structure [C, S]. SYNTAX: Y = WAVEBACK(C, S, 'WNAME'); Output inverse FWT matrix Y Y = WAVEBACK(C, S, LR, HR); using lowpass and highpass reconstruction filters (LR and HR) or filters obtained by calling WAVEFILTER with 'WNAME'. [NC, NS] = WAVEBACK(C, S, 'WNAME', N); Output new wavelet [NC, NS] = WAVEBACK(C, S, LR, HR, N); decomposition structure [NC, NS] after N step reconstruction. See also WAVEFAST and WAVEFILTER.
wavecopy.m
WAVECOPY Fetches coefficients of a wavelet decomposition structure. Y = WAVECOPY(TYPE, C, S, N) returns a coefficient array based on TYPE and N. INPUTS: TYPE Coefficient category ------------------------------------- 'a' Approximation coefficients 'h' Horizontal details 'v' Vertical details 'd' Diagonal details [C, S] is a wavelet data structure. N specifies a decomposition level (ignored if TYPE = 'a'). See also WAVEWORK, WAVECUT, and WAVEPASTE.
wavecut.m
WAVECUT Zeroes coefficients in a wavelet decomposition structure. [NC, Y] = WAVECUT(TYPE, C, S, N) returns a new decomposition vector whose detail or approximation coefficients (based on TYPE and N) have been zeroed. The coefficients that were zeroed are returned in Y. INPUTS: TYPE Coefficient category ------------------------------------- 'a' Approximation coefficients 'h' Horizontal details 'v' Vertical details 'd' Diagonal details [C, S] is a wavelet data structure. N specifies a decomposition level (ignored if TYPE = 'a'). See also WAVEWORK, WAVECOPY, and WAVEPASTE.
wavedisplay.m
WAVEDISPLAY Display wavelet decomposition coefficients. W = WAVEDISPLAY(C, S, SCALE, BORDER) displays and returns a wavelet coefficient image. EXAMPLES: wavedisplay(c, s); Display w/defaults. foo = wavedisplay(c, s); Display and return. foo = wavedisplay(c, s, 4); Magnify the details. foo = wavedisplay(c, s, -4); Magnify absolute values. foo = wavedisplay(c, s, 1, 'append'); Keep border values. INPUTS/OUTPUTS: [C, S] is a wavelet decomposition vector and bookkeeping matrix. SCALE Detail coefficient scaling ---------------------------------------------------------- 0 or 1 Maximum range (default) 2,3... Magnify default by the scale factor -1, -2... Magnify absolute values by abs(scale) BORDER Border between wavelet decompositions ---------------------------------------------------------- 'absorb' Border replaces image (default) 'append' Border increases width of image Image W: ------- ------ ------------ ------------------- | | | | | a(n) | h(n) | | | | | | ------- ------ h(n-1) | | | | | | v(n) | d(n) | | h(n-2) | | | | ------- ------ ------------ | | | | v(n-1) | d(n-1) | | | | -------------- ------------ ------------------- | | | v(n-2) | d(n-2) | | Here, n denotes the decomposition step scale and a, h, v, d are approximation, horizontal, vertical, and diagonal detail coefficients, respectively.
wavefast.m
WAVEFAST Computes the FWT of a '3-D extended' 2-D array. [C, L] = WAVEFAST(X, N, LP, HP) computes 'PAGES' 2D N-level FWTs of a 'ROWS x COLUMNS x PAGES' matrix X with respect to decomposition filters LP and HP. [C, L] = WAVEFAST(X, N, WNAME) performs the same operation but fetches filters LP and HP for wavelet WNAME using WAVEFILTER. Scale parameter N must be less than or equal to log2 of the maximum image dimension. Filters LP and HP must be even. To reduce border distortion, X is symmetrically extended. That is, if X = [c1 c2 c3 ... cn] (in 1D), then its symmetric extension would be [... c3 c2 c1 c1 c2 c3 ... cn cn cn-1 cn-2 ...]. OUTPUTS: Vector C is a coefficient decomposition vector: C = [ a1(n)...ak(n) h1(n)...hk(n) v1(n)...vk(n) d1(n)...dk(n) h1(n-1)... d1(1)...dk(1) ] where ai, hi, vi, and di for i = 0,1,...k are columnwise vectors containing approximation, horizontal, vertical, and diagonal coefficient matrices, respectively, and k is the number of pages in the 3-D extended array X. C has 3n + 1 sections where n is the number of wavelet decompositions. Matrix S is an [(n+2) x 2] bookkeeping matrix if k = 1; else it is [(n+2) x 3]: S = [ sa(n, :); sd(n, :); sd(n-1, :); ... ; sd(1, :); sx ] where sa and sd are approximation and detail size entries. See also WAVEBACK and WAVEFILTER.
wavefilter.m
WAVEFILTER Create wavelet decomposition and reconstruction filters. [VARARGOUT] = WAVEFILTER(WNAME, TYPE) returns the decomposition and/or reconstruction filters used in the computation of the forward and inverse FWT (fast wavelet transform). EXAMPLES: [ld, hd, lr, hr] = wavefilter('haar') Get the low and highpass decomposition (ld, hd) and reconstruction (lr, hr) filters for wavelet 'haar'. [ld, hd] = wavefilter('haar','d') Get decomposition filters ld and hd. [lr, hr] = wavefilter('haar','r') Get reconstruction filters lr and hr. INPUTS: WNAME Wavelet Name --------------------------------------------------------- 'haar' or 'db1' Haar 'db4' 4th order Daubechies 'sym4' 4th order Symlets 'bior6.8' Cohen-Daubechies-Feauveau biorthogonal 'jpeg9.7' Antonini-Barlaud-Mathieu-Daubechies TYPE Filter Type --------------------------------------------------------- 'd' Decomposition filters 'r' Reconstruction filters See also WAVEFAST and WAVEBACK.
wavepaste.m
WAVEPASTE Puts coefficients in a wavelet decomposition structure. NC = WAVEPASTE(TYPE, C, S, N, X) returns the new decomposition structure after pasting X into it based on TYPE and N. INPUTS: TYPE Coefficient category ------------------------------------- 'a' Approximation coefficients 'h' Horizontal details 'v' Vertical details 'd' Diagonal details [C, S] is a wavelet data structure. N specifies a decomposition level (Ignored if TYPE = 'a'). X is a 2- or 3-D approximation or detail coefficient matrix whose dimensions are appropriate for decomposition level N. See also WAVEWORK, WAVECUT, and WAVECOPY.
wavework.m
WAVEWORK is used to edit wavelet decomposition structures. [VARARGOUT] = WAVEWORK(OPCODE, TYPE, C, S, N, X) gets the coefficients specified by TYPE and N for access or modification based on OPCODE. INPUTS: OPCODE Operation to perform -------------------------------------------------------------- 'copy' [varargout] = Y = requested (via TYPE and N) coefficient matrix 'cut' [varargout] = [NC, Y] = New decomposition vector (with requested coefficient matrix zeroed) AND requested coefficient matrix 'paste' [varargout] = [NC] = new decomposition vector with coefficient matrix replaced by X TYPE Coefficient category -------------------------------------------- 'a' Approximation coefficients 'h' Horizontal details 'v' Vertical details 'd' Diagonal details [C, S] is a wavelet toolbox decomposition structure. N is a decomposition level (Ignored if TYPE = 'a'). X is a 2- or 3-D coefficient matrix for pasting. See also WAVECUT, WAVECOPY, and WAVEPASTE.
wavezero.m
WAVEZERO Zeroes wavelet transform detail coefficients. [NC, G8] = WAVEZERO(C, S, L, WNAME) zeroes the level L detail coefficients in wavelet decomposition structure [C, S] and computes the resulting inverse transform with respect to WNAME wavelets.
x2majoraxis.m
X2MAJORAXIS Aligns coordinate x with the major axis of a region. [C, THETA] = X2MAJORAXIS(A, B) aligns the x-coordinate axis with the major axis of a region or boundary. The y-axis is perpendicular to the x-axis. The rows of 2-by-2 matrix A are the coordinates of the two end points of the major axis, in the form A = [x1 y1; x2 y2]. Input B is either a binary image (i.e., an array of class logical) containing a single region, or it is an np-by-2 set of points representing a (connected) boundary. In the latter case, the first column of B must represent x-coordinates and the second column must represent the corresponding y-coordinates. Output C contains the same data as the input, but aligned with the major axis. If the input is an image, so is the output; similarly the output is a sequence of coordinates if the input is such a sequence. Parameter THETA is the initial angle between the major axis and the x-axis. The origin of the xy-axis system is at the bottom left; the x-axis is the horizontal axis and the y-axis is the vertical. Keep in mind that rotations can introduce round-off errors when the data are converted to integer (pixel) coordinates, which typically is a requirement. Thus, postprocessing (e.g., with bwmorph) of the output may be required to reconnect a boundary.
zeromf.m
ZEROMF Constant membership function (zero). ZEROMF(Z) returns an an array of zeros with the same size as Z. When using the @max operator to combine rule antecedents, associating this membership function with a particular input means that input has no effect.
mgrep.m
mgrep: searches (recursively or not) files on a path for a given searchstring usage: mfilelist = mgrep(searchstring) usage: mfilelist = mgrep(searchstring,startpath) usage: mfilelist = mgrep(searchstring,startpath,prop1,val1,...) usage: mgrep searchstring usage: mgrep searchstring startpath usage: mgrep searchstring startpath prop1 val1 ... arguments: (input) searchstring - string - search string (no wildcards) startpath - (OPTIONAL) string - contains top level directory to search The search will not be recursive by default. If left empty or not supplied, then startpath will be the current directory. Additional arguments are in the form of property/value pairs. Properties may be in any order, and may be shortened as long as that shotening is unambiguous, down to a single letter. Capitalization is ignored. Valid properties: 'recurse', 'wholewords', 'casesens', 'showline') The only legal values for each of these properties are 'on' or 'off' 'recurse' - 'on' --> Recursively search subdirectories on the path 'off' --> Restrict search to only the specified directory DEFAULT = 'on' 'wholewords' - 'on' --> Find occurences of searchstring as a whole word 'off' --> Allow partial word matches DEFAULT = 'off' 'casesens' - 'on' --> Use case sensitive matches in the search 'off' --> Ignore case in the search DEFAULT = 'off' 'showline' - 'on' --> Include the line that contained each match 'off' --> Do not display the lines with matches DEFAULT = 'on' Arguments: (output) mfilelist - a cell array If no output argument is provided for, then the results of mgrep will only be displayed in the command window. This is the behavior of mgrep when used in command mode. Example usages: Recursive search, starting in the current directory for the string 'fmin', returning the result as a cell array. Any of these 3 alternatives will work: filelist = mgrep('fmin'); filelist = mgrep('fmin',pwd); filelist = mgrep('fmin','.'); Simple search of the directory './mylocaldir' for the string 'fmin', display the result in the command window. Do not search subdirectories. mgrep fmin ./mylocaldir recurse off Case sensitive search for the name "John D'Errico", through all subdirectories beginning with the current directory. Display the results in the command window. mgrep 'John DErrico' . c on Much of this code is thanks to Brett Shoelson, Ph.D. My contribution was mainly the interface, plus any errors that may have surrepticiously appeared. John D'Errico, woodchips@rochester.rr.com