Skip to content

Commit 7409071

Browse files
committed
Add support for automatically reading and recognising Micro-Manager and ThorCam stack sequences
1 parent 9b6a4ea commit 7409071

11 files changed

Lines changed: 116 additions & 36 deletions

POLCAM-SR/POLCAM-SR.mlappinstall

-4.99 KB
Binary file not shown.

POLCAM-SR/POLCAM-SR.prj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<deployment-project plugin="plugin.apptool" plugin-version="1.0">
2-
<configuration build-checksum="3887477477" file="/Users/ezrabruggeman/Documents/GitHub/POLCAM-SR/POLCAM-SR/POLCAM-SR.prj" location="/Users/ezrabruggeman/Documents/GitHub/POLCAM-SR/POLCAM-SR" name="POLCAM-SR" target="target.mlapps" target-name="Package App">
2+
<configuration build-checksum="593887742" file="/Users/ezrabruggeman/Documents/GitHub/POLCAM-SR/POLCAM-SR/POLCAM-SR.prj" location="/Users/ezrabruggeman/Documents/GitHub/POLCAM-SR/POLCAM-SR" name="POLCAM-SR" target="target.mlapps" target-name="Package App">
33
<param.appname>POLCAM-SR</param.appname>
44
<param.authnamewatermark>Ezra Bruggeman</param.authnamewatermark>
55
<param.email>eb758@cam.ac.uk</param.email>
@@ -11,9 +11,9 @@
1111
<file>${PROJECT_ROOT}/POLCAM-SR_resources/icon_16.png</file>
1212
</param.icons>
1313
<param.summary>Application to process single-molecule and diffraction-limited polarisation camera image data</param.summary>
14-
<param.description />
15-
<param.screenshot>/private/var/folders/6j/9pmd1ms95nn1t7d0_vmbff240000gn/T/tp4d826ad8_365a_47b5_a645_bd57c593f95b.png</param.screenshot>
16-
<param.version>1.1</param.version>
14+
<param.description>Process single-molecule and diffraction-limited polarisation camera data</param.description>
15+
<param.screenshot>/private/var/folders/6j/9pmd1ms95nn1t7d0_vmbff240000gn/T/tp5fcb071b_fce0_4f70_936f_97e7dfa348c7.png</param.screenshot>
16+
<param.version>1.1.1</param.version>
1717
<param.products.name />
1818
<param.products.id />
1919
<param.products.version />
@@ -24,7 +24,6 @@
2424
<param.authnamewatermark />
2525
<param.email />
2626
<param.company />
27-
<param.description />
2827
<param.products.name />
2928
<param.products.id />
3029
<param.products.version />
@@ -56,7 +55,8 @@
5655
<file>${PROJECT_ROOT}/lib/+Utils/getAverageIntensityProjectionFromPath.m</file>
5756
<file>${PROJECT_ROOT}/lib/+Utils/getMaximumIntensityProjectionFromPath.m</file>
5857
<file>${PROJECT_ROOT}/lib/+Utils/getMinimumIntensityProjectionFromPath.m</file>
59-
<file>${PROJECT_ROOT}/lib/+Utils/getOrderedImageFilelist.m</file>
58+
<file>${PROJECT_ROOT}/lib/+Utils/getOrderedImageFilelist_MicroManager.m</file>
59+
<file>${PROJECT_ROOT}/lib/+Utils/getOrderedImageFilelist_ThorCam.m</file>
6060
<file>${PROJECT_ROOT}/lib/+Utils/getSumIntensityProjectionFromPath.m</file>
6161
<file>${PROJECT_ROOT}/lib/+Utils/readJsonFile.m</file>
6262
<file>${PROJECT_ROOT}/lib/+Utils/readTiffStack.m</file>

POLCAM-SR/POLCAM_SR.mlapp

-3.32 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"pathLastImg": "/Users/ezrabruggeman/Documents/GitHub/POLCAM-SR/POLCAM-SR/docs/samples/fibrils/",
2+
"pathLastImg": "/Users/ezrabruggeman/Desktop/test TC",
33
"pathLastLocs": "/Users/ezrabruggeman/Documents/GitHub/POLCAM-SR/POLCAM-SR/docs/samples/fibrils/"
44
}
File renamed without changes.
File renamed without changes.

POLCAM-SR/lib/+Utils/getOrderedImageFilelist.m

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
function filelist = getOrderedImageFilelist_MicroManager(directory)
2+
3+
% get list of all files with tif extension
4+
filelist_tif = dir(fullfile(directory,'*_MMStack_Default.ome.tif'));
5+
6+
% remove files that start with '.' (sometimes there are hidden files on mac)
7+
filelist_tif = filelist_tif(~startsWith({filelist_tif.name},'.'));
8+
9+
if isempty(filelist_tif)
10+
filelist = 0;
11+
else
12+
% sort files in ascending order
13+
filelist_tif = struct2table(filelist_tif);
14+
filelist_tif = sortrows(filelist_tif,'name','ascend');
15+
16+
% format for POLCAM-SR
17+
filelist = struct;
18+
for i=1:height(filelist_tif)
19+
[~,baseName_img,~] = fileparts(filelist_tif.name(i));
20+
filelist(i).filepath = char(fullfile(directory,filelist_tif.name(i)));
21+
filelist(i).baseName = extractBefore(baseName_img,'_MMStack_Default.ome');
22+
23+
% find position of underscores '_' in filename
24+
indeces_underscore = strfind(filelist(i).baseName,'_');
25+
% get the index of the last underscore
26+
index_last_underscore = indeces_underscore(end);
27+
% extract the number after the last underscore
28+
filelist(i).id = str2double(filelist(i).baseName(index_last_underscore+1:end));
29+
end
30+
% sort filenames based on suffix to get correct frame numbers
31+
[~,idx] = sort([filelist.id]);
32+
filelist = filelist(idx);
33+
end
34+
35+
end
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
function filelist = getOrderedImageFilelist_ThorCam(directory)
2+
3+
% get list of all files with tif extension
4+
filelist_tif = dir(fullfile(directory,'*.tif'));
5+
6+
% remove files that start with '.' (sometimes there are hidden files on mac)
7+
filelist_tif = filelist_tif(~startsWith({filelist_tif.name},'.'));
8+
9+
if isempty(filelist_tif)
10+
filelist = 0;
11+
else
12+
filelist = struct;
13+
for i=1:length(filelist_tif)
14+
[~,baseName_img,~] = fileparts(filelist_tif(i).name);
15+
filelist(i).filepath = fullfile(directory,filelist_tif(i).name);
16+
filelist(i).baseName = baseName_img;
17+
18+
% find position of underscores '_' in filename
19+
indeces_underscore = strfind(filelist(i).baseName,'_');
20+
% get the index of the last underscore
21+
index_last_underscore = indeces_underscore(end);
22+
filelist(i).id = str2double(filelist(i).baseName(index_last_underscore+1:end));
23+
end
24+
% sort filenames based on suffix to get correct frame numbers
25+
[~,idx] = sort([filelist.id]);
26+
filelist = filelist(idx);
27+
end
28+
29+
end
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
close all
3+
clear all
4+
clc
5+
6+
directory = '/Users/ezrabruggeman/Desktop/test MM';
7+
8+
9+
%%
10+
11+
% get list of all files with tif extension
12+
filelist_tif = dir(fullfile(directory,'*_MMStack_Default.ome.tif'));
13+
14+
% remove files that start with '.' (sometimes there are hidden files on mac)
15+
filelist_tif = filelist_tif(~startsWith({filelist_tif.name},'.'));
16+
17+
if isempty(filelist_tif)
18+
filelist = 0;
19+
else
20+
% sort files in ascending order
21+
filelist_tif = struct2table(filelist_tif);
22+
filelist_tif = sortrows(filelist_tif,'name','ascend');
23+
24+
% format for POLCAM-SR
25+
filelist = struct;
26+
for i=1:height(filelist_tif)
27+
[~,baseName_img,~] = fileparts(filelist_tif.name(i));
28+
filelist(i).filepath = char(fullfile(directory,filelist_tif.name(i)));
29+
filelist(i).baseName = extractBefore(baseName_img,'_MMStack_Default.ome');
30+
end
31+
32+
% sort filenames based on suffix to get correct frame numbers (ASSUMES THORCAM INDEXING)
33+
for i=1:length(filelist)
34+
% find position of underscores '_' in filename
35+
indeces_underscore = strfind(filelist(i).baseName,'_');
36+
% get the index of the last underscore
37+
index_last_underscore = indeces_underscore(end);
38+
% extract the number after the last underscore
39+
filelist(i).id = str2double(filelist(i).baseName(index_last_underscore+1:end));
40+
end
41+
[~,idx] = sort([filelist.id]);
42+
filelist = filelist(idx);
43+
end
44+
45+

0 commit comments

Comments
 (0)