Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hydra-image-processor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenSource
hydra-image-processor
Commits
b60ad17b
Commit
b60ad17b
authored
11 years ago
by
Eric Wait
Browse files
Options
Downloads
Patches
Plain Diff
Using the global readers
parent
b12f12c9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/MATLAB/tiffReader.m
+0
-109
0 additions, 109 deletions
src/MATLAB/tiffReader.m
src/MATLAB/tiffWriter.m
+0
-32
0 additions, 32 deletions
src/MATLAB/tiffWriter.m
with
0 additions
and
141 deletions
src/MATLAB/tiffReader.m
deleted
100644 → 0
+
0
−
109
View file @
b12f12c9
function im = tiffReader(datasetName,chan,type,dirName,nameConvention,cPos,tPos,zPos)
global DatasetName OrgDir
DatasetName = datasetName;
im = [];
if (~exist('dirName','var') || isempty(dirName))
fprintf('Select Image Dir...');
dirName = uigetdir();
disp(dirName);
end
if (~exist('nameConvention','var') || isempty(nameConvention))
nameConvention = '_c%d_t%04d_z%04d%s';
cPos = 1;
tPos = 2;
zPos = 3;
end
if (~exist('chan','var')|| isempty(chan))
chan = 0;
end
if (~exist('type','var') || isempty(type))
type = 'double';
end
if (strcmp(type,'double'))
bytes = 8;
elseif (strcmp(type,'uint8'))
bytes = 1;
else
error('Type not implemented');
end
OrgDir = dirName;
dList = dir(fullfile(dirName,'*.tif*'));
mxC = 0;
mxT = 0;
mxZ = 0;
mxX = 0;
mxY = 0;
for i=1:length(dList)
vals = textscan(dList(i).name,[datasetName nameConvention]);
if (isempty(vals) || isempty(vals{1}) || isempty(vals{2}) || isempty(vals{3}))
continue;
end
if (mxX==0 || mxY==0)
im = imread(fullfile(dirName,dList(i).name));
mxX = size(im,2);
mxY = size(im,1);
end
c = double(vals{cPos});
t = double(vals{tPos});
z = double(vals{zPos});
if (c>mxC)
mxC = c;
end
if (t>mxT)
mxT = t;
end
if (z>mxZ)
mxZ = z;
end
end
if (chan~=0)
mxC=1;
end
fprintf('%d,%d,%d,%d,%d, %4.2fGB\n',mxY,mxX,mxZ,mxT,mxC,mxY*mxX*mxZ*mxT*mxC*bytes/1024/1024/1024);
im = zeros(1,1,1,1,1);
if (bytes==8)
im = zeros(mxY,mxX,mxZ,mxT,mxC);
elseif (bytes==1)
im = zeros(mxY,mxX,mxZ,mxT,mxC,'uint8');
end
for i=1:length(dList)
vals = textscan(dList(i).name,[datasetName nameConvention]);
if (isempty(vals) || isempty(vals{1}) || isempty(vals{2}) || isempty(vals{3}))
continue;
end
c = vals{cPos};
if (chan~=0
&&
c~=chan)
continue;
end
t = vals{tPos};
z = vals{zPos};
if (bytes==8)
im(:,:,z,t,c) = imread(fullfile(dirName,dList(i).name));
elseif (bytes==1)
im(:,:,z,t,c) = uint8(imread(fullfile(dirName,dList(i).name)));
end
end
This diff is collapsed.
Click to expand it.
src/MATLAB/tiffWriter.m
deleted
100644 → 0
+
0
−
32
View file @
b12f12c9
function tiffWriter(image,prefix)
sizes = size(image);
numDim = length(sizes);
if numDim
<
5
channels =
1;
else
channels =
sizes(5);
end
if
numDim
<4
frames =
1;
else
frames =
sizes(4);
end
if
numDim
<3
stacks =
1;
else
stacks =
sizes(3);
end
for
c=
1:channels
for
t=
1:frames
for
z=
1:stacks
fileName =
sprintf('%s_c%d_t%04d_z%04d.tif',prefix,c,t,z);
imwrite
(
image
(
:
,
:
,
z
,
t
,
c
),
fileName
,'
tif
','
Compression
','
lzw
');
end
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment