Skip to content
Snippets Groups Projects
Commit 86361d09 authored by Eric Wait's avatar Eric Wait
Browse files

Changed how image names are handled

parent 5b2ba6a1
No related branches found
No related tags found
No related merge requests found
function pathString = GetFullImagePath(frame)
global CONSTANTS
image = Helper.GetImageName(frame);
pathString = [CONSTANTS.rootImageFolder image];
end
function imageName = GetImageName(frame)
global CONSTANTS
imageName = sprintf(CONSTANTS.imageNamePattern,frame);
end
% [sigDigits imageDataset] = ParseImageName(imageName) % [sigDigits imageDataset] = ParseImageName(imageName)
function [sigDigits imageDataset] = ParseImageName(imageName) function [sigDigits imageDataset] = ParseImageName(imageName)
sigDigits = 0; tIndex = strfind(imageName,'t');
index = strfind(imageName,'_t'); if (isempty(tIndex))
if ( ~isempty(index) ) error('File name does not have time component: %s',imageName);
indexEnd = strfind(imageName,'.');
sigDigits = indexEnd - index - 2;
imageDataset = imageName(1:(index(length(index))-1));
end end
endIndex = strfind(imageName,'.');
tIndex = tIndex(find(tIndex<endIndex,1,'last'));
if (tIndex+1==endIndex)
%TODO the t comes after the number
error('File name pattern is not yet supported: %s',imageName);
end
nanIndex = tIndex;
for i=1:endIndex-tIndex
if(isnan(str2double(imageName(tIndex+i))))
nanIndex = tIndex+i;
break;
end
end
if (nanIndex~=tIndex)
endIndex = nanIndex;
end
sigDigits = endIndex - tIndex - 1;
imageDataset = imageName(1:(tIndex)-1);
imageNamePattern = [imageDataset 't%0' num2str(sigDigits) 'd' imageName(endIndex:end)];
Load.AddConstant('imageNamePattern',imageNamePattern,1);
end end
\ No newline at end of file
...@@ -43,7 +43,7 @@ function AddImagePixelsField() ...@@ -43,7 +43,7 @@ function AddImagePixelsField()
for t=1:length(HashedCells) for t=1:length(HashedCells)
progress = progress+1; progress = progress+1;
UI.Progressbar(progress/iterations); UI.Progressbar(progress/iterations);
imgfname = [CONSTANTS.rootImageFolder CONSTANTS.datasetName '_t' Helper.GetDigitString(t) '.TIF']; imgfname = Helper.GetFullImagePath(t);
curimg = Helper.LoadIntensityImage(imgfname); curimg = Helper.LoadIntensityImage(imgfname);
hullIdx = [HashedCells{t}.hullID]; hullIdx = [HashedCells{t}.hullID];
......
...@@ -14,7 +14,7 @@ function FindSegLevels(bShowProgress) ...@@ -14,7 +14,7 @@ function FindSegLevels(bShowProgress)
UI.Progressbar((t-1)/length(HashedCells)); UI.Progressbar((t-1)/length(HashedCells));
end end
fileName = [CONSTANTS.rootImageFolder CONSTANTS.datasetName '_t' Helper.GetDigitString(t) '.TIF']; fileName = Helper.GetFullImagePath(t);
if exist(fileName,'file') if exist(fileName,'file')
im = Helper.LoadIntensityImage(fileName); im = Helper.LoadIntensityImage(fileName);
else else
......
...@@ -44,16 +44,14 @@ else ...@@ -44,16 +44,14 @@ else
save('ColorScheme','colors'); save('ColorScheme','colors');
end end
if (~exist('settings','var') || isempty(settings))
if (exist('LEVerSettings.mat','file')) if (exist('LEVerSettings.mat','file'))
load('LEVerSettings.mat'); load('LEVerSettings.mat');
else else
settings.imagePath = '.\'; settings.imagePath = '.\';
settings.matFilePath = '.\'; settings.matFilePath = '.\';
end
end end
filterIndexImage = 0;
goodLoad = 0; goodLoad = 0;
opened = 0; opened = 0;
...@@ -111,7 +109,7 @@ while ( (sigDigits == 0) || ~exist(fileName,'file') ) ...@@ -111,7 +109,7 @@ while ( (sigDigits == 0) || ~exist(fileName,'file') )
CONSTANTS.imageDatasetName = imageDataset; CONSTANTS.imageDatasetName = imageDataset;
CONSTANTS.datasetName = imageDataset; CONSTANTS.datasetName = imageDataset;
CONSTANTS.imageSignificantDigits = sigDigits; CONSTANTS.imageSignificantDigits = sigDigits;
fileName = [CONSTANTS.rootImageFolder imageDataset '_t' Helper.GetDigitString(1) '.TIF']; fileName = Helper.GetFullImagePath(1);
tryidx = tryidx + 1; tryidx = tryidx + 1;
end end
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
function newTrackID = AddNewSegmentHull(clickPt, time) function newTrackID = AddNewSegmentHull(clickPt, time)
global CONSTANTS global CONSTANTS
filename = [CONSTANTS.rootImageFolder CONSTANTS.datasetName '_t' Helper.GetDigitString(time) '.TIF']; filename = Helper.GetFullImagePath(time);
img = Helper.LoadIntensityImage(filename); img = Helper.LoadIntensityImage(filename);
[newObj newFeat] = Segmentation.PartialImageSegment(img, clickPt, 200, 1.0); [newObj newFeat] = Segmentation.PartialImageSegment(img, clickPt, 200, 1.0);
......
...@@ -20,7 +20,7 @@ CellHulls = struct(... ...@@ -20,7 +20,7 @@ CellHulls = struct(...
'userEdited', {}); 'userEdited', {});
for i=1:length(dir([CONSTANTS.rootImageFolder '\*.tif'])) for i=1:length(dir([CONSTANTS.rootImageFolder '\*.tif']))
filename = ['.\segmentationData\' CONSTANTS.datasetName '_t' Helper.GetDigitString(i) '.TIF_seg.txt']; filename = ['.\segmentationData\' Helper.GetImageName(i) '_seg.txt'];
while (isempty(dir(filename))) while (isempty(dir(filename)))
pause(5); pause(5);
end end
...@@ -46,7 +46,7 @@ for i=1:length(dir([CONSTANTS.rootImageFolder '\*.tif'])) ...@@ -46,7 +46,7 @@ for i=1:length(dir([CONSTANTS.rootImageFolder '\*.tif']))
end end
im = imread([CONSTANTS.rootImageFolder '\' CONSTANTS.datasetName '_t' Helper.GetDigitString(1) '.TIF']); im = imread(Helper.GetFullImagePath(1));
CONSTANTS.imageSize = size(im); CONSTANTS.imageSize = size(im);
for i=1:length(CellHulls) for i=1:length(CellHulls)
......
function [bwDark bwig bwHalo xlims ylims] = PartialSegDarkCenters(centerPt, t, imageAlpha) function [bwDark bwig bwHalo xlims ylims] = PartialSegDarkCenters(centerPt, t, imageAlpha)
global CONSTANTS SegLevels global CONSTANTS SegLevels
fileName = [CONSTANTS.rootImageFolder CONSTANTS.datasetName '_t' Helper.GetDigitString(t) '.TIF']; fileName = Helper.GetFullImagePath(t);
if exist(fileName,'file') if exist(fileName,'file')
im = Helper.LoadIntensityImage(fileName); im = Helper.LoadIntensityImage(fileName);
else else
......
...@@ -155,7 +155,7 @@ function newHullID = tryAddSegmentation(prevHull) ...@@ -155,7 +155,7 @@ function newHullID = tryAddSegmentation(prevHull)
global CONSTANTS CellHulls CellFeatures HashedCells Figures global CONSTANTS CellHulls CellFeatures HashedCells Figures
newHullID = []; newHullID = [];
fileName = [CONSTANTS.rootImageFolder CONSTANTS.datasetName '_t' Helper.GetDigitString(Figures.time) '.TIF']; fileName = Helper.GetFullImagePath(Figures.time);
img = Helper.LoadIntensityImage(fileName); img = Helper.LoadIntensityImage(fileName);
clickPt = [CellHulls(prevHull).centerOfMass(2) CellHulls(prevHull).centerOfMass(1)]; clickPt = [CellHulls(prevHull).centerOfMass(2) CellHulls(prevHull).centerOfMass(1)];
......
...@@ -37,7 +37,7 @@ if(isempty(CellFamilies(Figures.tree.familyID).tracks)),return,end ...@@ -37,7 +37,7 @@ if(isempty(CellFamilies(Figures.tree.familyID).tracks)),return,end
% figure(Figures.cells.handle); % figure(Figures.cells.handle);
set(Figures.cells.timeLabel,'String',['Time: ' num2str(Figures.time)]); set(Figures.cells.timeLabel,'String',['Time: ' num2str(Figures.time)]);
%read in image %read in image
filename = [CONSTANTS.rootImageFolder CONSTANTS.datasetName '_t' Helper.GetDigitString(Figures.time) '.TIF']; filename = Helper.GetFullImagePath(Figures.time);
if exist(filename,'file') if exist(filename,'file')
img = Helper.LoadIntensityImage(filename); img = Helper.LoadIntensityImage(filename);
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment