|
52 | 52 | inputFiles = dir([inputFolder '*.tif']);
|
53 | 53 | numInputFiles = length(inputFiles);
|
54 | 54 |
|
55 |
| - parfor f=1:numInputFiles |
56 |
| - |
57 |
| - [~, ~, ext] = fileparts(inputFiles(f).name); |
58 |
| - currentOutputFile = [parameters.detectionFolder strrep(inputFiles(f).name, ext, parameters.detectionExtension)]; |
59 |
| - |
60 |
| - if (isfile(currentOutputFile)) |
61 |
| - continue; |
62 |
| - end |
63 |
| - |
64 |
| - %% specify the XPIWIT command |
65 |
| - XPIWITCommand = ['./XPIWIT.sh --output "' outputFolderSeeds '" --input "0, ' inputFolder inputFiles(f).name ', 2, float" --xml "' parameters.XPIWITDetectionPipeline '" --seed 0 --lockfile off --subfolder "filterid, filtername" --outputformat "imagename, filtername" --end']; |
| 55 | + %% parfor seems to skip files occasionally, thus perform two consistency runs to be sure all files are present. |
| 56 | + for c=1:3 |
| 57 | + parfor f=1:numInputFiles |
| 58 | + |
| 59 | + [~, ~, ext] = fileparts(inputFiles(f).name); |
| 60 | + currentOutputFile = [parameters.detectionFolder strrep(inputFiles(f).name, ext, parameters.detectionExtension)]; |
| 61 | + |
| 62 | + if (isfile(currentOutputFile)) |
| 63 | + continue; |
| 64 | + end |
66 | 65 |
|
67 |
| - %% replace slashes by backslashes for windows systems |
68 |
| - if (ispc == true) |
69 |
| - XPIWITCommand = strrep(XPIWITCommand, './XPIWIT.sh', 'XPIWIT.exe'); |
70 |
| - XPIWITCommand = strrep(XPIWITCommand, '\', '/'); |
| 66 | + %% specify the XPIWIT command |
| 67 | + XPIWITCommand = ['./XPIWIT.sh --output "' outputFolderSeeds '" --input "0, ' inputFolder inputFiles(f).name ', 2, float" --xml "' parameters.XPIWITDetectionPipeline '" --seed 0 --lockfile off --subfolder "filterid, filtername" --outputformat "imagename, filtername" --end']; |
| 68 | + |
| 69 | + %% replace slashes by backslashes for windows systems |
| 70 | + if (ispc == true) |
| 71 | + XPIWITCommand = strrep(XPIWITCommand, './XPIWIT.sh', 'XPIWIT.exe'); |
| 72 | + XPIWITCommand = strrep(XPIWITCommand, '\', '/'); |
| 73 | + end |
| 74 | + system(XPIWITCommand); |
71 | 75 | end
|
72 |
| - system(XPIWITCommand); |
73 | 76 | end
|
74 |
| - |
75 | 77 | cd(oldPath);
|
76 | 78 |
|
77 | 79 | %% perform cell pose segmentation (optional)
|
78 | 80 | if (parameters.useCellpose == true)
|
79 | 81 | parameters.outputFolderCellPose = [outputFolder 'Cellpose/'];
|
80 | 82 | outputDataExists = true;
|
81 | 83 | if (~isfolder(parameters.outputFolderCellPose))
|
82 |
| - mkdir(parameters.outputFolderCellPose); |
| 84 | + mkdir(parameters.outputFolderCellPose); |
| 85 | + outputDataExists = false; |
83 | 86 | else
|
84 | 87 | %% check if output images already exist
|
85 |
| - inputFiles = dir([inputFolder '*.tif']); |
| 88 | + inputFiles = dir([inputFolder parameters.channelFilter parameters.channelFilter '*.tif']); |
86 | 89 | outputFiles = dir([parameters.outputFolderCellPose '*_cp_masks.png']);
|
87 | 90 | numInputFiles = length(inputFiles);
|
88 | 91 | numOutputFiles = length(outputFiles);
|
|
0 commit comments