This is a static copy of a profile report

Home

imagesci/private/readtif (11550 calls, 106.708 sec)
Generated 05-Nov-2014 07:52:37 using cpu time.
function in file /usr1/opt/matlab/7.13/toolbox/matlab/imagesci/private/readtif.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
imreadfunction11550
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
51
[X, map, details] = rtifc(args...
11550100.068 s93.8%
35
args = parse_args(varargin{:})...
115503.445 s3.2%
38
args.pixelregion = process_reg...
115500.771 s0.7%
36
checkIndex(args.index)
115500.761 s0.7%
44
if args.index > numel(args....
113610.391 s0.4%
All other lines  1.272 s1.2%
Totals  106.708 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
imagesci/private/rtifcMEX-file1155099.738 s93.5%
imagesci/private/readtif>parse_argssubfunction115503.234 s3.0%
imagesci/private/readtif>checkIndexsubfunction115500.611 s0.6%
imagesci/private/readtif>process_regionsubfunction115500.471 s0.4%
Self time (built-ins, overhead, etc.)  2.654 s2.5%
Totals  106.708 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function82
Non-code lines (comments, blank lines)54
Code lines (lines that can run)28
Code lines that did run12
Code lines that did not run16
Coverage (did run/can run)42.86 %
Function listing
   time   calls  line
1 function [X,map] = readtif(filename, varargin)
2 %READTIF Read an image from a TIFF file.
3 % [X,MAP] = READTIF(FILENAME) reads the first image from the
4 % TIFF file specified by the string variable FILENAME. X will
5 % be a 2-D uint8 array if the specified data set contains an
6 % 8-bit image. It will be an M-by-N-by-3 uint8 array if the
7 % specified data set contains a 24-bit image. MAP contains the
8 % colormap if present; otherwise it is empty.
9 %
10 % [X,MAP] = READTIF(FILENAME, N, ...) reads the Nth image from the
11 % file.
12 %
13 % READTIF accepts trailing parameter-value pairs. The parameter names and
14 % corresponding values are:
15 %
16 % Parameter Name Value
17 % -------------- -----
18 % Index Scalar; same as input parameter N above
19 %
20 % Info Struct; same as input parameter INFO above
21 %
22 % PixelRegion {ROWS, COLS}
23 % reads a region of pixels from the file. ROWS
24 % and COLS are two- or three-element vectors,
25 % where the first value is the start location,
26 % and the last value is the ending location. In
27 % the three-value syntax, the second value is the
28 % increment.
29 %
30 % See also IMREAD, IMWRITE, IMFINFO.
31
32 % Copyright 1984-2011 The MathWorks, Inc.
33 % $Revision: 1.1.6.14 $ $Date: 2011/05/17 02:28:09 $
34
3.44 11550 35 args = parse_args(varargin{:});
0.76 11550 36 checkIndex(args.index)
0.14 11550 37 args.filename = filename;
0.77 11550 38 args.pixelregion = process_region(args.pixelregion);
39
0.13 11550 40 if ~isempty(args.info) && isfield(args.info, 'Offset')
41 % If INFO input is provided, use the Offset field to determine where the
42 % specified image is located in the file.
43
0.39 11361 44 if args.index > numel(args.info)
45 error(message('MATLAB:imagesci:readtif:indexInfoMismatch'));
46 end
47
0.13 11361 48 args.offset = args.info(args.index).Offset;
0.02 11361 49 end
50
100.07 11550 51 [X, map, details] = rtifc(args);
52
0.25 11550 53 map = double(map)/65535;
54
0.27 11550 55 if (details.Photo == 8)
56 % TIFF image is in CIELAB format. Issue a warning that we're
57 % converting the data to ICCLAB format, and correct the a* and b*
58 % values.
59
60 % First, though, check to make sure we have the expected number of
61 % samples per pixel.
62 if (size(X,3) ~= 1) && (size(X,3) ~= 3)
63 error(message('MATLAB:imagesci:readtif:unexpectedCIELabSamplesPerPixel'));
64 end
65
66 % Now check that we have uint8 or uint16 data.
67 if ~ (isa(X,'uint8') || isa(X,'uint16'))
68 error(message('MATLAB:imagesci:readtif:wrongCieLabDatatype', class( X )));
69 end
70
71 warning(message('MATLAB:imagesci:readtif:CielabConversion'));
72
73 X = cielab2icclab(X);
0.11 11550 74 elseif (details.Photo == 0)
75 if (details.BitsPerSample == 1)
76 % TIFF image is MinIsWhite and logical. Invert it.
77 X = ~X;
78 elseif (details.Photo == 0) && (details.BitsPerSample <= 8)
79 % TIFF image is MinIsWhite and not more than one byte. Invert it.
80 X = 2^(details.BitsPerSample) - 1 - X;
81 end
82 end

Other subfunctions in this file are not included in this listing.