Skip to content

Commit

Permalink
Merge pull request #2 from CGK-Laboratory/WIP
Browse files Browse the repository at this point in the history
update main
  • Loading branch information
ferchaure authored Nov 14, 2024
2 parents a24fb52 + c0c83b2 commit ffe6c0c
Show file tree
Hide file tree
Showing 19 changed files with 411 additions and 490 deletions.
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Set default behavior to automatically normalize line endings.
* text=auto

# Force batch scripts to always use CRLF line endings so that if a repo is accessed
# in Windows via a file share from Linux, the scripts will work.
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
*.{ics,[iI][cC][sS]} text eol=crlf

# Force bash scripts to always use LF line endings so that if a repo is accessed
# in Unix via a file share from Windows, the scripts will work.
*.sh text eol=lf
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.tif
*.asv
*.xls
/CellSellect_3DMorph_resources
/CellSellect_3DMorph
127 changes: 127 additions & 0 deletions CellSellect_3DMorph.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<deployment-project plugin="plugin.ezdeploy" plugin-version="1.0">
<configuration build-checksum="636892865" file="C:\Users\user\Documents\GitHub\3DMorph\CellSellect_3DMorph.prj" location="C:\Users\user\Documents\GitHub\3DMorph" name="CellSellect_3DMorph" preferred-package-location="C:\Users\user\Documents\GitHub\3DMorph\CellSellect_3DMorph\for_redistribution" preferred-package-type="package.type.exe" target="target.ezdeploy.standalone" target-name="Application Compiler">
<param.appname>CellSellect_3DMorph</param.appname>
<param.icon>${PROJECT_ROOT}\CellSellect_3DMorph_resources\icon.ico</param.icon>
<param.icons>
<file>${PROJECT_ROOT}\CellSellect_3DMorph_resources\icon_48.png</file>
<file>${PROJECT_ROOT}\CellSellect_3DMorph_resources\icon_32.png</file>
<file>${PROJECT_ROOT}\CellSellect_3DMorph_resources\icon_24.png</file>
<file>${PROJECT_ROOT}\CellSellect_3DMorph_resources\icon_16.png</file>
</param.icons>
<param.version>1.0</param.version>
<param.authnamewatermark>Fernando Julian Chaure</param.authnamewatermark>
<param.email />
<param.company />
<param.summary>CellSelect-3DMorph isolates and analyzes cells morphology from 3D images, by reconstructing the cells from fluorescent pixels.</param.summary>
<param.description>The code allows to obtain different parameters including cell volume (exact number of pixels occupied by the cell), territorial volume (maximum cell extension), ramification index (territorial volume/cell volume), branch length, number of branch and end points, and more. CellSelect uses the 3D Morph developed code but now adds the possibility of rejecting any cell that is not complete in the frame of the image (x, y and z positions) and which the morphology cannot be calculated properly.</param.description>
<param.screenshot>${PROJECT_ROOT}\Functions\CGKlab-splash.png</param.screenshot>
<param.guid />
<param.installpath.string>\CellSellect_3DMorph\</param.installpath.string>
<param.installpath.combo>option.installpath.programfiles</param.installpath.combo>
<param.logo />
<param.install.notes>This installer only includes MEX functions compiled for Windows.</param.install.notes>
<param.target.install.notes />
<param.intermediate>${PROJECT_ROOT}\CellSellect_3DMorph\for_testing</param.intermediate>
<param.files.only>${PROJECT_ROOT}\CellSellect_3DMorph\for_redistribution_files_only</param.files.only>
<param.output>${PROJECT_ROOT}\CellSellect_3DMorph\for_redistribution</param.output>
<param.logdir>${PROJECT_ROOT}\CellSellect_3DMorph</param.logdir>
<param.enable.clean.build>false</param.enable.clean.build>
<param.user.defined.mcr.options />
<param.target.type>subtarget.standalone</param.target.type>
<param.support.packages />
<param.web.mcr>true</param.web.mcr>
<param.package.mcr>false</param.package.mcr>
<param.no.mcr>false</param.no.mcr>
<param.web.mcr.name>CellSelect-3DMorph_installer</param.web.mcr.name>
<param.package.mcr.name>MyAppInstaller_mcr</param.package.mcr.name>
<param.no.mcr.name>MyAppInstaller_app</param.no.mcr.name>
<param.windows.command.prompt>true</param.windows.command.prompt>
<param.create.log>false</param.create.log>
<param.log.file />
<param.native.matlab>false</param.native.matlab>
<param.checkbox>false</param.checkbox>
<param.example />
<param.help.text>Syntax
-?

Input Arguments
-? print help on how to use the application
input arguments</param.help.text>
<unset>
<param.version />
<param.email />
<param.company />
<param.guid />
<param.installpath.string />
<param.installpath.combo />
<param.logo />
<param.target.install.notes />
<param.intermediate />
<param.files.only />
<param.output />
<param.logdir />
<param.enable.clean.build />
<param.user.defined.mcr.options />
<param.target.type />
<param.support.packages />
<param.web.mcr />
<param.package.mcr />
<param.no.mcr />
<param.package.mcr.name />
<param.no.mcr.name />
<param.windows.command.prompt />
<param.create.log />
<param.log.file />
<param.native.matlab />
<param.checkbox />
<param.example />
</unset>
<fileset.main>
<file>${PROJECT_ROOT}\Script_3DMorph.m</file>
</fileset.main>
<fileset.resources>
<file>${PROJECT_ROOT}\Functions</file>
<file>${PROJECT_ROOT}\Script_3DMorph.m</file>
</fileset.resources>
<fileset.package />
<fileset.depfun />
<build-deliverables>
<file location="${PROJECT_ROOT}\CellSellect_3DMorph\for_testing" name="CellSellect_3DMorph.exe" optional="false">C:\Users\user\Documents\GitHub\3DMorph\CellSellect_3DMorph\for_testing\CellSellect_3DMorph.exe</file>
<file location="${PROJECT_ROOT}\CellSellect_3DMorph\for_testing" name="splash.png" optional="false">C:\Users\user\Documents\GitHub\3DMorph\CellSellect_3DMorph\for_testing\splash.png</file>
<file location="${PROJECT_ROOT}\CellSellect_3DMorph\for_testing" name="readme.txt" optional="true">C:\Users\user\Documents\GitHub\3DMorph\CellSellect_3DMorph\for_testing\readme.txt</file>
</build-deliverables>
<workflow />
<matlab>
<root>C:\Program Files\MATLAB\R2020a</root>
<toolboxes>
<toolbox name="matlabcoder" />
<toolbox name="neuralnetwork" />
</toolboxes>
<toolbox>
<matlabcoder>
<enabled>true</enabled>
</matlabcoder>
</toolbox>
<toolbox>
<neuralnetwork>
<enabled>true</enabled>
</neuralnetwork>
</toolbox>
</matlab>
<platform>
<unix>false</unix>
<mac>false</mac>
<windows>true</windows>
<win2k>false</win2k>
<winxp>false</winxp>
<vista>false</vista>
<linux>false</linux>
<solaris>false</solaris>
<osver>10.0</osver>
<os32>false</os32>
<os64>true</os64>
<arch>win64</arch>
<matlab>true</matlab>
</platform>
</configuration>
</deployment-project>
Binary file added Functions/CGKlab-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Functions/CGKlab-splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Functions/CellSizeCutoffGUI.fig
Binary file not shown.
15 changes: 14 additions & 1 deletion Functions/CellSizeCutoffGUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

% Edit the above text to modify the response to help CellSizeCutoffGUI

% Last Modified by GUIDE v2.5 23-Nov-2017 11:06:07
% Last Modified by GUIDE v2.5 20-Jul-2024 07:28:34

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
Expand Down Expand Up @@ -201,3 +201,16 @@ function OutputImage_Callback(hObject, eventdata, handles)
box = get(hObject,'Value');
% Store application data
setappdata(handles.CellSizeCutoffGUI,'ShowObjImgs',box);


% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
msgbox(["Once you select a pixel value, Matlab will run through all of your objects. If its pixel value is larger than your selected cut off, it will segment this object.";
"Matlab will do this by first eroding the object using the diamond method and a value of 3. You can change these values in the script if you want more or less erosion.";
"The number of objects left after this erosion is considered to be the number of actual cells within the object. This value and the original object are then passed to the fit Gaussian mixture distribution method (see: fitgmdist), to determine where to separate the cells.";
"";
"Tip:";
"Too much segmentation? It may think a large process is a separate cell. Try increasing the erosion value.";
"Losing parts of cells? They are likely not properly connected to the correct cell, and so are removed in the filtering step to remove noise. Try adjusting your noise and threshold values, or removing this function. Warning: you may get a strange effect here during the branch length measurements.";
"Find line: ex=bwareaopen(ex,noise);"], ...
'Additional Information');
32 changes: 0 additions & 32 deletions Functions/FastMarching_version3b/functions/pointmin.asv

This file was deleted.

15 changes: 2 additions & 13 deletions Functions/FastMarching_version3b/msfm.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
% fprintf('MSFM2: %9.5f %9.5f %9.5f\n', Results{4}(1), Results{4}(2), Results{4}(3));
%
% Function is written by D.Kroon University of Twente (Oct 2010)
add_function_paths();

% Modified by Fernando Chaure (May 2024) Removing addpath, it's expected done
%
if(nargin<3), UseSecond=false; end
if(nargin<4), UseCross=false; end

Expand All @@ -107,14 +107,3 @@
T=msfm2d(F, SourcePoints, UseSecond, UseCross);
end
end

function add_function_paths()
try
functionname='msfm.m';
functiondir=which(functionname);
functiondir=functiondir(1:end-length(functionname));
addpath([functiondir '/functions'])
addpath([functiondir '/shortestpath'])
catch me
disp(me.message);
end
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
% This function MSFM3D calculates the shortest distance from a list of
% points to all other pixels in an image volume, using the
% Multistencil Fast Marching Method (MSFM). This method gives more accurate
% distances by using second order derivatives and cross neighbours.
%
% T=msfm3d(F, SourcePoints, UseSecond, UseCross)
%
% inputs,
% F: The 3D speed image. The speed function must always be larger
% than zero (min value 1e-8), otherwise some regions will
% never be reached because the time will go to infinity.
% SourcePoints : A list of starting points [3 x N] (distance zero)
% UseSecond : Boolean Set to true if not only first but also second
% order derivatives are used (default)
% UseCross : Boolean Set to true if also cross neighbours
% are used (default)
% outputs,
% T : Image with distance from SourcePoints to all pixels
%
% Note:
% First you need to compile the c file "mex msfm3d.c"
%
% Literature : M. Sabry Hassouna et Al. Multistencils Fast Marching
% Methods: A Highly Accurate Solution to the Eikonal Equation on
% Cartesian Domains
%
% Example,
% % compile the needed mex file
% mex msfm3d.c
%
% SourcePoint = [21; 21; 21];
% SpeedImage = ones([41 41 41]);
% [X,Y,Z] = ndgrid(1:41, 1:41, 1:41);
% T1 = sqrt((X-SourcePoint(1)).^2 + (Y-SourcePoint(2)).^2 + (Z-SourcePoint(3)).^2);
%
% % Run fast marching 1th order, 1th order multi stencil
% % and 2th orde and 2th orde multi stencil
%
% tic; T1_FMM1 = msfm3d(SpeedImage, SourcePoint, false, false); toc;
% tic; T1_MSFM1 = msfm3d(SpeedImage, SourcePoint, false, true); toc;
% tic; T1_FMM2 = msfm3d(SpeedImage, SourcePoint, true, false); toc;
% tic; T1_MSFM2 = msfm3d(SpeedImage, SourcePoint, true, true); toc;
%
% % Show results
% fprintf('\nResults with T1 (Matlab)\n');
% fprintf('Method L1 L2 Linf\n');
% Results = cellfun(@(x)([mean(abs(T1(:)-x(:))) mean((T1(:)-x(:)).^2) max(abs(T1(:)-x(:)))]), {T1_FMM1(:) T1_MSFM1(:) T1_FMM2(:) T1_MSFM2(:)}, 'UniformOutput',false);
% fprintf('FMM1: %9.5f %9.5f %9.5f\n', Results{1}(1), Results{1}(2), Results{1}(3));
% fprintf('MSFM1: %9.5f %9.5f %9.5f\n', Results{2}(1), Results{2}(2), Results{2}(3));
% fprintf('FMM2: %9.5f %9.5f %9.5f\n', Results{3}(1), Results{3}(2), Results{3}(3));
% fprintf('MSFM2: %9.5f %9.5f %9.5f\n', Results{4}(1), Results{4}(2), Results{4}(3));

% This function MSFM3D calculates the shortest distance from a list of
% points to all other pixels in an image volume, using the
% Multistencil Fast Marching Method (MSFM). This method gives more accurate
% distances by using second order derivatives and cross neighbours.
%
% T=msfm3d(F, SourcePoints, UseSecond, UseCross)
%
% inputs,
% F: The 3D speed image. The speed function must always be larger
% than zero (min value 1e-8), otherwise some regions will
% never be reached because the time will go to infinity.
% SourcePoints : A list of starting points [3 x N] (distance zero)
% UseSecond : Boolean Set to true if not only first but also second
% order derivatives are used (default)
% UseCross : Boolean Set to true if also cross neighbours
% are used (default)
% outputs,
% T : Image with distance from SourcePoints to all pixels
%
% Note:
% First you need to compile the c file "mex msfm3d.c"
%
% Literature : M. Sabry Hassouna et Al. Multistencils Fast Marching
% Methods: A Highly Accurate Solution to the Eikonal Equation on
% Cartesian Domains
%
% Example,
% % compile the needed mex file
% mex msfm3d.c
%
% SourcePoint = [21; 21; 21];
% SpeedImage = ones([41 41 41]);
% [X,Y,Z] = ndgrid(1:41, 1:41, 1:41);
% T1 = sqrt((X-SourcePoint(1)).^2 + (Y-SourcePoint(2)).^2 + (Z-SourcePoint(3)).^2);
%
% % Run fast marching 1th order, 1th order multi stencil
% % and 2th orde and 2th orde multi stencil
%
% tic; T1_FMM1 = msfm3d(SpeedImage, SourcePoint, false, false); toc;
% tic; T1_MSFM1 = msfm3d(SpeedImage, SourcePoint, false, true); toc;
% tic; T1_FMM2 = msfm3d(SpeedImage, SourcePoint, true, false); toc;
% tic; T1_MSFM2 = msfm3d(SpeedImage, SourcePoint, true, true); toc;
%
% % Show results
% fprintf('\nResults with T1 (Matlab)\n');
% fprintf('Method L1 L2 Linf\n');
% Results = cellfun(@(x)([mean(abs(T1(:)-x(:))) mean((T1(:)-x(:)).^2) max(abs(T1(:)-x(:)))]), {T1_FMM1(:) T1_MSFM1(:) T1_FMM2(:) T1_MSFM2(:)}, 'UniformOutput',false);
% fprintf('FMM1: %9.5f %9.5f %9.5f\n', Results{1}(1), Results{1}(2), Results{1}(3));
% fprintf('MSFM1: %9.5f %9.5f %9.5f\n', Results{2}(1), Results{2}(2), Results{2}(3));
% fprintf('FMM2: %9.5f %9.5f %9.5f\n', Results{3}(1), Results{3}(2), Results{3}(3));
% fprintf('MSFM2: %9.5f %9.5f %9.5f\n', Results{4}(1), Results{4}(2), Results{4}(3));

Binary file removed Functions/FileDataGUI.fig
Binary file not shown.
Loading

0 comments on commit ffe6c0c

Please sign in to comment.