-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
79 changed files
with
8,905 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
function answer = demo2D00( option ) | ||
% demo2D00 | ||
% | ||
% Synthesize one 2D image with nuclear, cell shape, and vesicular channels | ||
% from all vesicular object models (nucleoli, lysosomes, endosomes, and | ||
% mitochondria) without convolution. The model was trained from the Murphy | ||
% Lab 2D HeLa dataset. | ||
% | ||
% Input | ||
% ----- | ||
% * a list of valid CellOrganizer model files | ||
% | ||
% Output | ||
% ------ | ||
% * one TIFF file with six slices (nuclear, cell shape, nucleolar, | ||
% lysosomal, endosomal, and mitochondrial channels) | ||
|
||
% Ivan E. Cao-Berg (icaoberg@cmu.edu) | ||
% | ||
% Copyright (C) 2012-2019 Murphy Lab | ||
% Computational Biology Department | ||
% School of Computer Science | ||
% Carnegie Mellon University | ||
% | ||
% This program is free software; you can redistribute it and/or modify | ||
% it under the terms of the GNU General Public License as published | ||
% by the Free Software Foundation; either version 2 of the License, | ||
% or (at your option) any later version. | ||
% | ||
% This program is distributed in the hope that it will be useful, but | ||
% WITHOUT ANY WARRANTY; without even the implied warranty of | ||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
% General Public License for more details. | ||
% | ||
% You should have received a copy of the GNU General Public License | ||
% along with this program; if not, write to the Free Software | ||
% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
% 02110-1301, USA. | ||
% | ||
% For additional information visit http://murphylab.web.cmu.edu or | ||
% send email to murphy@cmu.edu | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% DO NOT MODIFY THIS BLOCK | ||
if ~isdeployed() | ||
current_path = which(mfilename); | ||
[current_path, filename, extension] = fileparts( current_path ); | ||
cd(current_path); | ||
end | ||
|
||
disp( 'demo2D00' ); | ||
|
||
options.seed = 12345; | ||
try | ||
state = rng( options.seed ); | ||
catch err | ||
rand( 'seed', options.seed ); %#ok<RAND> | ||
end | ||
|
||
options.targetDirectory = pwd; | ||
options.prefix = 'imgs'; | ||
options.compression = 'lzw'; | ||
options.debug = false; | ||
options.temporary_results = [ pwd filesep 'temporary_results' ]; | ||
options.verbose = false; | ||
options.synthesis = 'all'; | ||
options.output.tifimages = false; | ||
options.output.OMETIFF = true; | ||
options.numberOfSynthesizedImages = 1; | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
answer = slml2img( {'../../../models/2D/nucleolus.mat', ... | ||
'../../../models/2D/lysosome.mat', ... | ||
'../../../models/2D/endosome.mat', ... | ||
'../../../models/2D/mitochondrion.mat'}, options ); | ||
end%demo2D00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
function answer = demo2D01( options ) | ||
% demo2D01 | ||
% | ||
% Train a 2D generative model of the nucleus, cell shape, and lysosomes using | ||
% all LAMP2 images in the Murphy Lab 2D HeLa dataset. | ||
% | ||
% Input | ||
% ----- | ||
% * a directory of raw or synthetic nucleus images | ||
% * a directory of raw or synthetic cell shape images | ||
% * a directory of raw or synthetic lysosome images | ||
% * the resolution of the images (all images should have the same | ||
% resolution) | ||
% | ||
% Output | ||
% ------ | ||
% * a valid SLML model file | ||
|
||
% Ivan E. Cao-Berg (icaoberg@cmu.edu) | ||
% | ||
% Copyright (C) 2013-2020 Murphy Lab | ||
% Computational Biology Department | ||
% School of Computer Science | ||
% Carnegie Mellon University | ||
% | ||
% This program is free software; you can redistribute it and/or modify | ||
% it under the terms of the GNU General Public License as published | ||
% by the Free Software Foundation; either version 2 of the License, | ||
% or (at your option) any later version. | ||
% | ||
% This program is distributed in the hope that it will be useful, but | ||
% WITHOUT ANY WARRANTY; without even the implied warranty of | ||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
% General Public License for more details. | ||
% | ||
% You should have received a copy of the GNU General Public License | ||
% along with this program; if not, write to the Free Software | ||
% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
% 02110-1301, USA. | ||
% | ||
% For additional information visit http://murphylab.web.cmu.edu or | ||
% send email to murphy@cmu.edu | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% DO NOT MODIFY THIS BLOCK | ||
if ~isdeployed() | ||
current_path = which(mfilename); | ||
[current_path, filename, extension] = fileparts( current_path ); | ||
get_murphylab_image_collections( true ); | ||
cd(current_path); | ||
end | ||
|
||
disp( 'demo2D01' ); | ||
disp( 'The estimated running time is 7-10 minutes. Please wait.' ); | ||
|
||
options.verbose = true; | ||
options.debug = true; | ||
options.save_segmentations = true; | ||
options.display = false; | ||
options.skip_preprocessing = true; | ||
options.model.name = 'demo2D01'; | ||
options = ml_initparam( options, struct( ... | ||
'train', struct( 'flag', 'all' ))); | ||
options.nucleus.class = 'nuclear_membrane'; | ||
options.nucleus.type = 'medial_axis'; | ||
options.cell.class = 'cell_membrane'; | ||
options.cell.type = 'ratio'; | ||
options.protein.class = 'vesicle'; | ||
options.save_segmentations = true; | ||
options.protein.type = 'gmm'; | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
dna = {}; cellm = {}; protein = {}; options.masks = {}; options.labels = {}; | ||
|
||
directory = '../../../images/HeLa/2D/LAM'; | ||
for i=1:1:25 | ||
dna{length(dna)+1} = [ directory filesep 'orgdna' filesep 'cell' num2str(i) '.tif' ]; | ||
cellm{length(cellm)+1} = [ directory filesep 'orgcell' filesep 'cell' num2str(i) '.tif' ]; | ||
protein{length(protein)+1} = [ directory filesep 'orgprot' filesep 'cell' num2str(i) '.tif' ]; | ||
options.labels{length(options.labels)+1} = 'LAMP2'; | ||
options.masks{length(options.masks)+1} = [ directory filesep 'crop' filesep 'cell' num2str(i) '.tif' ]; | ||
end | ||
|
||
options.temporary_results = [ pwd filesep 'temporary_results' ]; | ||
options.model.resolution = [ 0.049, 0.049 ]; | ||
options.model.filename = 'lamp2.xml'; | ||
options.model.id = 'lamp2'; | ||
options.model.name = 'lamp2'; | ||
|
||
%documentation | ||
options.documentation.description = 'This model has been trained using demo2D01 from CellOrganizer'; | ||
|
||
answer = img2slml( '2D', dna, cellm, protein, options ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
function answer = demo2D02() | ||
% demo2D02 | ||
% | ||
% Synthesize one 2D image with nuclear, cell shape, and lysosomal channels | ||
% from LAMP2 model trained in demo2D01 without convolution. | ||
% | ||
% Input | ||
% ----- | ||
% * a valid CellOrganizer model file | ||
% | ||
% Output | ||
% ------ | ||
% * one TIFF file with three slices (nuclear, cell shape, and lysosomal | ||
% channels) | ||
|
||
% Ivan E. Cao-Berg (icaoberg@cmu.edu) | ||
% | ||
% Copyright (C) 2013-2018 Murphy Lab | ||
% Computational Biology Department | ||
% School of Computer Science | ||
% Carnegie Mellon University | ||
% | ||
% This program is free software; you can redistribute it and/or modify | ||
% it under the terms of the GNU General Public License as published | ||
% by the Free Software Foundation; either version 2 of the License, | ||
% or (at your option) any later version. | ||
% | ||
% This program is distributed in the hope that it will be useful, but | ||
% WITHOUT ANY WARRANTY; without even the implied warranty of | ||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
% General Public License for more details. | ||
% | ||
% You should have received a copy of the GNU General Public License | ||
% along with this program; if not, write to the Free Software | ||
% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
% 02110-1301, USA. | ||
% | ||
% For additional information visit http://murphylab.web.cmu.edu or | ||
% send email to murphy@cmu.edu | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% DO NOT MODIFY THIS BLOCK | ||
if ~isdeployed() | ||
current_path = which(mfilename); | ||
[current_path, filename, extension] = fileparts( current_path ); | ||
cd(current_path); | ||
end | ||
|
||
disp( 'demo2D02' ); | ||
disp( 'The estimated running time is 1 minute. Please wait.' ); | ||
|
||
options.seed = 12345; | ||
try | ||
state = rng( options.seed ); | ||
catch err | ||
rand( 'seed', options.seed ); %#ok<RAND> | ||
end | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
%modify the next line to generate more images | ||
options.numberOfSynthesizedImages = 1; | ||
|
||
options.targetDirectory = pwd; | ||
options.prefix = 'img'; | ||
options.compression = 'lzw'; | ||
options.debug = false; | ||
options.verbose = true; | ||
options.display = false; | ||
|
||
filename = '../demo2D01/lamp2.mat'; | ||
if ~exist( filename ) | ||
warning( [ 'File ' filename ' not found.' ] ); | ||
disp('Using alternative model present in this distribution.'); | ||
filename = '../../../models/2D/endosome.mat'; | ||
end | ||
|
||
options.output.tifimages = false; | ||
options.output.OMETIFF = true; | ||
|
||
slml2img( {filename}, options ); | ||
answer = true; | ||
end%demo2D02 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
function answer = demo2D03(options) | ||
% demo2D03 | ||
% | ||
% Train 2D generative model of the nucleus and cell shape using | ||
% all LAMP2 images in the Murphy Lab 2D HeLa dataset. | ||
% | ||
% Input | ||
% ----- | ||
% * a directory of raw or synthetic nucleus images | ||
% * a directory of raw or synthetic cell shape images | ||
% * the resolution of the images (all images should have the same | ||
% resolution) | ||
% | ||
% Output | ||
% ------ | ||
% * a valid SLML model file | ||
|
||
% Ivan E. Cao-Berg (icaoberg@cmu.edu) | ||
% | ||
% Copyright (C) 2015-2019 Murphy Lab | ||
% Computational Biology Department | ||
% School of Computer Science | ||
% Carnegie Mellon University | ||
% | ||
% This program is free software; you can redistribute it and/or modify | ||
% it under the terms of the GNU General Public License as published | ||
% by the Free Software Foundation; either version 2 of the License, | ||
% or (at your option) any later version. | ||
% | ||
% This program is distributed in the hope that it will be useful, but | ||
% WITHOUT ANY WARRANTY; without even the implied warranty of | ||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
% General Public License for more details. | ||
% | ||
% You should have received a copy of the GNU General Public License | ||
% along with this program; if not, write to the Free Software | ||
% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
% 02110-1301, USA. | ||
% | ||
% For additional information visit http://murphylab.web.cmu.edu or | ||
% send email to murphy@cmu.edu | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% DO NOT MODIFY THIS BLOCK | ||
if ~isdeployed() | ||
current_path = which(mfilename); | ||
[current_path, filename, extension] = fileparts( current_path ); | ||
get_murphylab_image_collections( true ); | ||
cd(current_path); | ||
end | ||
|
||
disp( 'demo2D03' ); | ||
warning('This demo is deprecated. The demo will be removed in future versions of CellOrganizer'); | ||
disp( 'The estimated running time is 9 minutes. Please wait.' ); | ||
|
||
options.verbose = true; | ||
options.debug = true; | ||
options.display = false; | ||
options.model.name = 'demo2D03'; | ||
options = ml_initparam( options, struct( ... | ||
'train', struct( 'flag', 'framework' ))); | ||
options.nucleus.class = 'nuclear_membrane'; | ||
options.nucleus.type = 'medial_axis'; | ||
options.cell.class = 'cell_membrane'; | ||
options.cell.type = 'ratio'; | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
% the following list of parameters are adapted to the LAMP2 image | ||
% collection, modify these according to your needs | ||
directory = '../../../images/HeLa/2D/LAM/'; | ||
dna = {}; cellm = {}; protein = {}; options.masks = {}; | ||
for i=1:1:25 | ||
dna{length(dna)+1} = [ directory filesep 'orgdna' filesep 'cell' num2str(i) '.tif' ]; | ||
cellm{length(cellm)+1} = [ directory filesep 'orgcell' filesep 'cell' num2str(i) '.tif' ]; | ||
options.masks{length(options.masks)+1} = [ directory filesep 'crop' filesep 'cell' num2str(i) '.tif' ]; | ||
end | ||
|
||
options.model.resolution = [ 0.049, 0.049 ]; | ||
options.model.filename = 'lamp2.xml'; | ||
options.model.id = 'lamp2'; | ||
|
||
%documentation | ||
options.documentation.description = 'This model has been trained using demo2D0333 from CellOrganizer'; | ||
|
||
answer = img2slml( '2D', dna, cellm, protein, options ); |
Oops, something went wrong.