-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from bahanonu/bahanonu/functionUpdates
Code and GUI improvements, NoRMCorre and additional file formats support, etc.
- Loading branch information
Showing
70 changed files
with
4,110 additions
and
1,513 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
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,32 @@ | ||
function [bfSeriesNo] = getSeriesNoFromName(inputMoviePath,bfSeriesName,varargin) | ||
% [bfSeriesNo] = getSeriesNoFromName(inputFilePath,bfSeriesName,varargin) | ||
% | ||
% Returns series number for Bio-Formats series with name given by user. | ||
% | ||
% Biafra Ahanonu | ||
% started: 2022.07.15 [08:10:16] | ||
% | ||
% Inputs | ||
% inputFilePath - Str: path to Bio-Formats compatible file. | ||
% bfSeriesName - Str: name of series within the file. Can be a regular expression. | ||
% | ||
% Outputs | ||
% bfSeriesNo - Int: series number (1-based indexing) matching the input series name. NaN is output if no series is found. | ||
% | ||
% Options (input as Name-Value with Name = options.(Name)) | ||
% % File ID connection from calling bfGetReader(inputFilePath), this is to save time on larger files by avoiding opening the connection again. | ||
% options.fileIdOpen = ''; | ||
|
||
% Changelog | ||
% | ||
% TODO | ||
% | ||
|
||
try | ||
bfSeriesNo = ciapkg.bf.getSeriesNoFromName(inputMoviePath,bfSeriesName,'passArgs',varargin); | ||
catch err | ||
disp(repmat('@',1,7)) | ||
disp(getReport(err,'extended','hyperlinks','on')); | ||
disp(repmat('@',1,7)) | ||
end | ||
end |
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,27 @@ | ||
function [valid, algorithmStr, infoStruct] = loadSignalExtractionSorting(inputFilePath,varargin) | ||
% [valid,algorithmStr,infoStruct] = loadSignalExtractionSorting(inputFilePath,varargin) | ||
% | ||
% Loads manual or automated (e.g. CLEAN) sorting.. | ||
% | ||
% Biafra Ahanonu | ||
% started: 2022.05.31 [20:14:54] (branched from modelVarsFromFiles) | ||
% | ||
% Inputs | ||
% inputFilePath - Str: path to signal extraction output. | ||
% | ||
% Outputs | ||
% valid - logical vector: indicating which signals are valid and should be kept. | ||
% algorithmStr - Str: algorithm name. | ||
% infoStruct - Struct: contains information about the file, e.g. the 'description' property that can contain information about the algorithm. | ||
% | ||
% Options (input as Name-Value with Name = options.(Name)) | ||
% % DESCRIPTION | ||
% options.exampleOption = ''; | ||
|
||
% Changelog | ||
% | ||
% TODO | ||
% | ||
|
||
[valid, algorithmStr, infoStruct] = ciapkg.io.loadSignalExtractionSorting(inputFilePath,'passArgs', varargin); | ||
end |
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
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,17 @@ | ||
function [pullStruct] = mergeStructs(toStruct,fromStruct,varargin) | ||
% [toStruct] = mergeStructs(fromStruct,toStruct,overwritePullFields) | ||
% | ||
% Copies fields in fromStruct into toStruct, if there is an overlap in field names, fromStruct overwrites toStruct unless specified otherwise. | ||
% | ||
% Biafra Ahanonu | ||
% started: 2014.02.12 | ||
% | ||
% inputs | ||
% toStruct - Structure that is to be updated with values from fromStruct. | ||
% fromStruct - structure to use to overwrite toStruct. | ||
% overwritePullFields - 1 = overwrite toStruct fields with fromStruct, 0 = don't overwrite. | ||
% outputs | ||
% toStruct - structure with fromStructs values added. | ||
|
||
[pullStruct] = ciapkg.io.mergeStructs(toStruct,fromStruct,'passArgs', varargin); | ||
end |
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
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 [seriesNameArray] = dispFileSeries(inputFilePath,varargin) | ||
% [bfSeriesNo] = getSeriesNoFromName(inputFilePath,bfSeriesName,varargin) | ||
% | ||
% Returns series number for Bio-Formats series with name given by user. | ||
% | ||
% Biafra Ahanonu | ||
% started: 2022.07.15 [08:10:16] | ||
% | ||
% Inputs | ||
% inputFilePath - Str: path to Bio-Formats compatible file. | ||
% | ||
% Outputs | ||
% bfSeriesNo - Int: series number (1-based indexing) matching the input series name. NaN is output if no series is found. | ||
% | ||
% Options (input as Name-Value with Name = options.(Name)) | ||
% % File ID connection from calling bfGetReader(inputFilePath), this is to save time on larger files by avoiding opening the connection again. | ||
% options.fileIdOpen = ''; | ||
|
||
% Changelog | ||
% | ||
% TODO | ||
% | ||
|
||
% ======================== | ||
% File ID connection from calling bfGetReader(inputFilePath), this is to save time on larger files by avoiding opening the connection again. | ||
options.fileIdOpen = []; | ||
% get options | ||
options = ciapkg.io.getOptions(options,varargin); | ||
% disp(options) | ||
% unpack options into current workspace | ||
% fn=fieldnames(options); | ||
% for i=1:length(fn) | ||
% eval([fn{i} '=options.' fn{i} ';']); | ||
% end | ||
% ======================== | ||
|
||
try | ||
% By default output NaN if no series found. | ||
seriesNameArray = {}; | ||
|
||
if isempty(options.fileIdOpen) | ||
disp(['Opening connection to Bio-Formats file:' inputFilePath]) | ||
startReadTime = tic; | ||
fileIdOpen = bfGetReader(inputFilePath); | ||
toc(startReadTime) | ||
else | ||
fileIdOpen = options.fileIdOpen; | ||
end | ||
omeMeta = fileIdOpen.getMetadataStore(); | ||
|
||
nSeries = fileIdOpen.getSeriesCount(); | ||
seriesNameArray = cell([1 nSeries]); | ||
disp('===') | ||
disp(['Series in file: ' inputFilePath]) | ||
for seriesNo = 1:nSeries | ||
% Convert 1-based to 0-based indexing. | ||
thisStr = char(omeMeta.getImageName(seriesNo-1)); | ||
seriesNameArray{seriesNo} = thisStr; | ||
disp([num2str(seriesNo) ': "' thisStr '"']) | ||
end | ||
disp('===') | ||
catch err | ||
disp(repmat('@',1,7)) | ||
disp(getReport(err,'extended','hyperlinks','on')); | ||
disp(repmat('@',1,7)) | ||
end | ||
|
||
function [outputs] = nestedfxn_exampleFxn(arg) | ||
% Always start nested functions with "nestedfxn_" prefix. | ||
% outputs = ; | ||
end | ||
end | ||
function [outputs] = localfxn_exampleFxn(arg) | ||
% Always start local functions with "localfxn_" prefix. | ||
% outputs = ; | ||
end |
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,88 @@ | ||
function [bfSeriesNo] = getSeriesNoFromName(inputFilePath,bfSeriesName,varargin) | ||
% [bfSeriesNo] = getSeriesNoFromName(inputFilePath,bfSeriesName,varargin) | ||
% | ||
% Returns series number for Bio-Formats series with name given by user. | ||
% | ||
% Biafra Ahanonu | ||
% started: 2022.07.15 [08:10:16] | ||
% | ||
% Inputs | ||
% inputFilePath - Str: path to Bio-Formats compatible file. | ||
% bfSeriesName - Str: name of series within the file. Can be a regular expression. | ||
% | ||
% Outputs | ||
% bfSeriesNo - Int: series number (1-based indexing) matching the input series name. NaN is output if no series is found. | ||
% | ||
% Options (input as Name-Value with Name = options.(Name)) | ||
% % File ID connection from calling bfGetReader(inputFilePath), this is to save time on larger files by avoiding opening the connection again. | ||
% options.fileIdOpen = ''; | ||
|
||
% Changelog | ||
% | ||
% TODO | ||
% | ||
|
||
% ======================== | ||
% File ID connection from calling bfGetReader(inputFilePath), this is to save time on larger files by avoiding opening the connection again. | ||
options.fileIdOpen = []; | ||
% get options | ||
options = ciapkg.io.getOptions(options,varargin); | ||
% disp(options) | ||
% unpack options into current workspace | ||
% fn=fieldnames(options); | ||
% for i=1:length(fn) | ||
% eval([fn{i} '=options.' fn{i} ';']); | ||
% end | ||
% ======================== | ||
|
||
try | ||
% By default output NaN if no series found. | ||
bfSeriesNo = NaN; | ||
|
||
if isempty(options.fileIdOpen) | ||
disp(['Opening connection to Bio-Formats file:' inputFilePath]) | ||
startReadTime = tic; | ||
fileIdOpen = bfGetReader(inputFilePath); | ||
toc(startReadTime) | ||
else | ||
fileIdOpen = options.fileIdOpen; | ||
end | ||
omeMeta = fileIdOpen.getMetadataStore(); | ||
|
||
if isempty(bfSeriesName) | ||
disp('Please provide a series name for Bio-Formats') | ||
else | ||
disp(['Searching for series: "' bfSeriesName '"']) | ||
nSeries = fileIdOpen.getSeriesCount(); | ||
seriesNameArray = cell([1 nSeries]); | ||
disp('===') | ||
disp(['Series in file: ' inputFilePath]) | ||
for seriesNo = 1:nSeries | ||
% Convert 1-based to 0-based indexing. | ||
thisStr = char(omeMeta.getImageName(seriesNo-1)); | ||
seriesNameArray{seriesNo} = thisStr; | ||
disp([num2str(seriesNo) ': "' thisStr '"']) | ||
end | ||
disp('===') | ||
matchIdx = ~cellfun(@isempty,regexp(seriesNameArray,bfSeriesName)); | ||
if any(matchIdx) | ||
bfSeriesNo = find(matchIdx); | ||
bfSeriesNo = bfSeriesNo(1); | ||
disp(['Series found: ' num2str(bfSeriesNo) ' - "' seriesNameArray{bfSeriesNo} '"']) | ||
end | ||
end | ||
catch err | ||
disp(repmat('@',1,7)) | ||
disp(getReport(err,'extended','hyperlinks','on')); | ||
disp(repmat('@',1,7)) | ||
end | ||
|
||
function [outputs] = nestedfxn_exampleFxn(arg) | ||
% Always start nested functions with "nestedfxn_" prefix. | ||
% outputs = ; | ||
end | ||
end | ||
function [outputs] = localfxn_exampleFxn(arg) | ||
% Always start local functions with "localfxn_" prefix. | ||
% outputs = ; | ||
end |
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
Oops, something went wrong.