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

Fixed Initialize Constants to be dependent on Cell Type

parent 30ed0ebb
Branches
Tags
No related merge requests found
...@@ -25,8 +25,19 @@ ...@@ -25,8 +25,19 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function InitializeConstants() function InitializeConstants()
%Set all constants here %% Set all constants here
global CONSTANTS
im = imread(Helper.GetFullImagePath(1));
Load.AddConstant('imageSize',size(im),1);
if (~isfield(CONSTANTS,'cellType') || isempty(CONSTANTS.cellType))
type = questdlg('Cell Type:','Cell Type','Adult','Hemato','Adult');
Load.AddConstant('cellType',type,1);
end
%% Common Constants
Load.AddConstant('imageAlpha', 1.5); Load.AddConstant('imageAlpha', 1.5);
Load.AddConstant('maxPixelDistance', 40,1); Load.AddConstant('maxPixelDistance', 40,1);
Load.AddConstant('maxCenterOfMassDistance', 40,1); Load.AddConstant('maxCenterOfMassDistance', 40,1);
...@@ -37,10 +48,25 @@ Load.AddConstant('minFamilyTimeFrame',25, 1); ...@@ -37,10 +48,25 @@ Load.AddConstant('minFamilyTimeFrame',25, 1);
Load.AddConstant('maxFrameDifference', 1, 1); Load.AddConstant('maxFrameDifference', 1, 1);
Load.AddConstant('historySize', 10, 1); Load.AddConstant('historySize', 10, 1);
Load.AddConstant('clickMargin', 500, 1); Load.AddConstant('clickMargin', 500, 1);
Load.AddConstant('timeResolution',10); %in frames per min Load.AddConstant('minTrackScore', 0.5,1);
Load.AddConstant('maxPropagateFrames', 50,1);
%% Particular Constants
switch CONSTANTS.cellType
case 'Adult'
Load.AddConstant('timeResolution', 10); %in min per frame
Load.AddConstant('dMaxCenterOfMass', 40,1); Load.AddConstant('dMaxCenterOfMass', 40,1);
Load.AddConstant('dMaxConnectComponent', 40,1); Load.AddConstant('dMaxConnectComponent', 40,1);
Load.AddConstant('dMaxConnectComponentTracker', 20,1); Load.AddConstant('dMaxConnectComponentTracker', 20,1);
Load.AddConstant('minTrackScore',0.5,1); case 'Hemato'
Load.AddConstant('maxPropagateFrames',50,1); Load.AddConstant('timeResolution', 5); %in min per frame
Load.AddConstant('dMaxCenterOfMass', 80,1);
Load.AddConstant('dMaxConnectComponent', 80,1);
Load.AddConstant('dMaxConnectComponentTracker', 40,1);
otherwise
Load.AddConstant('timeResolution', 10); %in min per frame
Load.AddConstant('dMaxCenterOfMass', 40,1);
Load.AddConstant('dMaxConnectComponent', 40,1);
Load.AddConstant('dMaxConnectComponentTracker', 20,1);
end
end end
...@@ -103,11 +103,10 @@ switch answer ...@@ -103,11 +103,10 @@ switch answer
end end
load('LEVerSettings.mat'); load('LEVerSettings.mat');
Load.InitializeConstants();
Load.AddConstant('version',softwareVersion,1); Load.AddConstant('version',softwareVersion,1);
CONSTANTS.cellType = [];
Load.InitializeConstants();
type = questdlg('Cell Type:','Cell Type','Adult','Hemato','Adult');
Load.AddConstant('cellType',type,1);
errOpen = Segmentation.SegAndTrack(); errOpen = Segmentation.SegAndTrack();
if(~errOpen) if(~errOpen)
opened = 1; opened = 1;
...@@ -150,11 +149,6 @@ switch answer ...@@ -150,11 +149,6 @@ switch answer
return return
end end
if (~isfield(CONSTANTS,'cellType'))
type = questdlg('Cell Type:','Cell Type','Adult','Hemeta','Adult');
Load.AddConstant('cellType',type,1);
end
errors = mexIntegrityCheck(); errors = mexIntegrityCheck();
if ( ~isempty(errors) ) if ( ~isempty(errors) )
warndlg('There were database inconsistencies. LEVer might not behave properly!'); warndlg('There were database inconsistencies. LEVer might not behave properly!');
...@@ -167,6 +161,8 @@ switch answer ...@@ -167,6 +161,8 @@ switch answer
Error.LogAction(['Opened file ' CONSTANTS.matFullFile]); Error.LogAction(['Opened file ' CONSTANTS.matFullFile]);
Load.InitializeConstants();
UI.InitializeFigures(); UI.InitializeFigures();
bUpdated = Load.FixOldFileVersions(); bUpdated = Load.FixOldFileVersions();
......
function HematoSegmentation(imageAlpha) function HematoSegmentation()
global CONSTANTS CellHulls global CONSTANTS CellHulls
eccentricity = 1.0; eccentricity = 1.0;
minVol = 200; minVol = 200;
...@@ -10,7 +10,7 @@ end ...@@ -10,7 +10,7 @@ end
fprintf(1,'Segmentation...'); fprintf(1,'Segmentation...');
system(['start HematoSeg.exe ' CONSTANTS.rootImageFolder '* ' num2str(imageAlpha) ' ' num2str(minVol) ' ' num2str(eccentricity) ' .9 && exit']); system(['start HematoSeg.exe ' CONSTANTS.rootImageFolder '* ' num2str(CONSTANTS.imageAlpha) ' ' num2str(minVol) ' ' num2str(eccentricity) ' .9 && exit']);
pause(20); pause(20);
CellHulls = struct(... CellHulls = struct(...
...@@ -49,9 +49,6 @@ for i=1:length(dir([CONSTANTS.rootImageFolder '\*.tif'])) ...@@ -49,9 +49,6 @@ for i=1:length(dir([CONSTANTS.rootImageFolder '\*.tif']))
end end
im = imread(Helper.GetFullImagePath(1));
Load.AddConstant('imageSize',size(im),1);
for i=1:length(CellHulls) for i=1:length(CellHulls)
[r c] = ind2sub(CONSTANTS.imageSize,CellHulls(i).indexPixels); [r c] = ind2sub(CONSTANTS.imageSize,CellHulls(i).indexPixels);
ch = convhull(r,c); ch = convhull(r,c);
......
...@@ -57,11 +57,8 @@ function errStatus = SegAndTrack() ...@@ -57,11 +57,8 @@ function errStatus = SegAndTrack()
switch CONSTANTS.cellType switch CONSTANTS.cellType
case 'Hemato' case 'Hemato'
tic; tic;
Segmentation.HematoSegmentation(1.2); Segmentation.HematoSegmentation();
tSeg = toc; tSeg = toc;
Load.AddConstant('dMaxCenterOfMass',80,1);
Load.AddConstant('dMaxConnectComponent',80,1);
Load.AddConstant('dMaxConnectComponentTracker',40,1);
tic; tic;
Tracker.HematoTracker(); Tracker.HematoTracker();
tTrack = toc; tTrack = toc;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
function DrawTree(familyID) function DrawTree(familyID)
global CellFamilies HashedCells Figures CONSTANTS CellTracks CellPhenotypes global CellFamilies HashedCells Figures CellPhenotypes
if ( ~exist('familyID','var') || isempty(familyID) ) if ( ~exist('familyID','var') || isempty(familyID) )
Families.FindLargestTree(); Families.FindLargestTree();
...@@ -40,10 +40,6 @@ end ...@@ -40,10 +40,6 @@ end
phenoScratch.phenoColors = hsv(length(CellPhenotypes.descriptions)); phenoScratch.phenoColors = hsv(length(CellPhenotypes.descriptions));
phenoScratch.phenoLegendSet = zeros(length(CellPhenotypes.descriptions),1); phenoScratch.phenoLegendSet = zeros(length(CellPhenotypes.descriptions),1);
if(~isfield(CONSTANTS,'timeResolution'))
CONSTANTS.timeResolution = 10;
end
if(isempty(CellFamilies(familyID).tracks)),return,end if(isempty(CellFamilies(familyID).tracks)),return,end
%let the user know that this might take a while %let the user know that this might take a while
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment