diff --git a/.gitignore b/.gitignore index 85223e81651b3b3988329852ccbfbf6f788e6c2a..867e20ea8e5b3ceef33ad3a1d604bc3ad0ac1f7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ +*~ bin/*.c bin/*.log *.mat diff --git a/src/MATLAB/AddConstant.m b/src/MATLAB/AddConstant.m new file mode 100644 index 0000000000000000000000000000000000000000..1f1314075786fcc4b908d66c435af213e308f7a1 --- /dev/null +++ b/src/MATLAB/AddConstant.m @@ -0,0 +1,21 @@ +function AddConstant(field,val,overWrite) +% AddConstant(field,val,overWrite) will add the given field to the +% CONSTANTS global variable and assign it the given value. +% overWrite - is an optional flag {0,1} that will force the new value if +% the field exists. Zero will keep the old value, One will overwrite the +% current value + +%--Eric Wait + +global CONSTANTS + +if(~exist('overWrite','var')) + overWrite = 0; +end + +if(~isfield(CONSTANTS,field)) + CONSTANTS.(field) = val; +elseif(overWrite) + CONSTANTS.(field) = val; +end +end \ No newline at end of file diff --git a/src/MATLAB/InitializeConstants.m b/src/MATLAB/InitializeConstants.m index e61181fa7eb5e6cdcef81520d82f11cc82058cc6..b82f31f56935f8098a6db06acb80aab0b48eb45f 100644 --- a/src/MATLAB/InitializeConstants.m +++ b/src/MATLAB/InitializeConstants.m @@ -2,23 +2,22 @@ function InitializeConstants() %Set all constants here %--Eric Wait -global CONSTANTS -CONSTANTS.imageAlpha = 1; -CONSTANTS.maxRetrackDistSq = 40^2; -CONSTANTS.maxPixelDistance = 40; -CONSTANTS.maxCenterOfMassDistance = 80; -CONSTANTS.minParentCandidateTimeFrame = 5; -CONSTANTS.minParentHistoryTimeFrame = 5; -CONSTANTS.minParentFuture = 5; -CONSTANTS.minFamilyTimeFrame = 5; -CONSTANTS.maxFrameDifference = 5; -CONSTANTS.historySize = 50; -CONSTANTS.clickMargin = 500; -CONSTANTS.timeResolution = 10; %in frames per min -CONSTANTS.dMaxConnectComponet = 40; -CONSTANTS.dMaxCenterOfMass = 80; -CONSTANTS.lookAhead = 2; -CONSTANTS.minPlayer = 9; -CONSTANTS.minMitosis = 30; +AddConstant('imageAlpha',1.5); +AddConstant('maxRetrackDistSq',40^2); +AddConstant('maxPixelDistance',40); +AddConstant('maxCenterOfMassDistance',80); +AddConstant('minParentCandidateTimeFrame',5); +AddConstant('minParentHistoryTimeFrame',5); +AddConstant('minParentFuture',5); +AddConstant('minFamilyTimeFrame',5); +AddConstant('maxFrameDifference',5); +AddConstant('historySize',50); +AddConstant('clickMargin',500); +AddConstant('timeResolution',10); %in frames per min +AddConstant('dMaxConnectComponet',40); +AddConstant('dMaxCenterOfMass',80); +AddConstant('lookAhead',2); +AddConstant('minPlayer',9); +AddConstant('minMitosis',30); end \ No newline at end of file diff --git a/src/MATLAB/OpenData.m b/src/MATLAB/OpenData.m index a08b69211eefa3d47cb9d3eca373dbc2ec6aa883..7aad96c8232034383281b266700681668c3a6cf4 100644 --- a/src/MATLAB/OpenData.m +++ b/src/MATLAB/OpenData.m @@ -7,7 +7,7 @@ function opened = OpenData() global Figures Colors CONSTANTS CellFamilies CellHulls HashedCells Costs CellTracks if(isempty(Figures)) - fprintf('LEVer ver 4.0\n***DO NOT DISTRIBUTE***\n\n'); + fprintf('LEVer ver 4.1\n***DO NOT DISTRIBUTE***\n\n'); end if(exist('ColorScheme.mat','file')) @@ -30,11 +30,6 @@ if (~exist('settings','var') || isempty(settings)) end filterIndexImage = 0; -matFile = []; -matFilePath = []; -imageFile = []; -imagePath = []; -imageDataset = []; goodLoad = 0; opened = 0; @@ -56,7 +51,6 @@ if(~isempty(Figures)) end oldCONSTANTS = CONSTANTS; -InitializeConstants(); %find the first image imageFilter = [settings.imagePath '*.TIF']; @@ -70,7 +64,6 @@ while (filterIndexImage==0) end index = strfind(settings.imageFile,'_t'); -frameT = '001'; if (~isempty(index) && filterIndexImage~=0) CONSTANTS.rootImageFolder = settings.imagePath; imageDataset = settings.imageFile(1:(index(length(index))-1)); @@ -117,11 +110,11 @@ switch answer end catch end - CellFamilies = []; - CellTracks = []; - CellHulls = []; - HashedCells = []; - Costs = []; +% CellFamilies = []; +% CellTracks = []; +% CellHulls = []; +% HashedCells = []; +% Costs = []; rootImageFolder = CONSTANTS.rootImageFolder; imageSignificantDigits = CONSTANTS.imageSignificantDigits; @@ -160,7 +153,7 @@ switch answer Figures.time = 1; - LogAction(['Opened file ' matFile],[],[]); + LogAction(['Opened file ' settings.matFile],[],[]); otherwise return end diff --git a/src/MATLAB/SegAndTrack.m b/src/MATLAB/SegAndTrack.m index a80271ef4c67881c1adab8bcb7c43ef2c265a99b..ddb2799ea522ee8ceece1c7669e4d4d293875e95 100644 --- a/src/MATLAB/SegAndTrack.m +++ b/src/MATLAB/SegAndTrack.m @@ -51,7 +51,6 @@ WriteSegData(cellSegments,CONSTANTS.datasetName); fprintf(1,'\nDone\n'); -load ( ['SegObjs_' CONSTANTS.datasetName '.mat']); fnameIn=['SegObjs_' CONSTANTS.datasetName '.txt']; fnameOut=['Tracked_' CONSTANTS.datasetName '.txt']; tSeg=toc; diff --git a/src/MATLAB/Segmentor.m b/src/MATLAB/Segmentor.m index 1e01b41543787e661a9acff7003856d7fe75f565..b14d8ca7923117dc9e8979be35e59d20284af07e 100644 --- a/src/MATLAB/Segmentor.m +++ b/src/MATLAB/Segmentor.m @@ -8,7 +8,7 @@ function objs = Segmentor(tStart,tLength,rootImageFolder,datasetName,imageAlpha, %--Andrew Cohen % global CONSTANTS -se=strel('square',3); + objs=[]; if(ischar(tStart)),tStart = str2double(tStart);end @@ -30,6 +30,11 @@ for t = tStart:tStart + tLength fname=[rootImageFolder '\' datasetName '_t' frameT '.TIF']; if(isempty(dir(fname))),continue,end + fprintf('%d, ', t); + if ( mod(t,20) == 0 ) + fprintf('\n'); + end + [im map]=imread(fname); im=mat2gray(im); @@ -44,7 +49,7 @@ for t = tStart:tStart + tLength % bwNorm=GetNormalVectors(bwHalo,bwDark); bwNorm=0*bwDark; - + se=strel('square',3); gd=imdilate(im,se); ge=imerode(im,se); ig=gd-ge; diff --git a/src/MATLAB/TrackSplitHulls.m b/src/MATLAB/TrackSplitHulls.m index d5ba2212a3bf81f8200a951ec917171230ad9a3b..5ca54d55ea089e19b453a028dd866a791f103fa0 100644 --- a/src/MATLAB/TrackSplitHulls.m +++ b/src/MATLAB/TrackSplitHulls.m @@ -2,7 +2,12 @@ function trackIDs = TrackSplitHulls(newHulls, forceTracks, COM) global CONSTANTS CellHulls HashedCells t = CellHulls(newHulls(1)).time; - trackIDs = [CellHulls(newHulls).trackID]; + + trackIDs = []; + for i = 1:length(newHulls) + trackIDs = [trackIDs GetTrackID(newHulls(i))]; + end + if ( t <= 1 ) return; end