Permalink
Browse files

first commit

  • Loading branch information...
jries committed Aug 7, 2017
0 parents commit 10324183e9b247827a44cc571941dbf0e53ec4d7
Showing with 201,952 additions and 0 deletions.
  1. BIN Manuscript_fit3D.pdf
  2. +16 −0 Readme.txt
  3. BIN Supplementary_Figures.pdf
  4. +54 −0 bfmatlab/bfCheckJavaMemory.m
  5. +118 −0 bfmatlab/bfCheckJavaPath.m
  6. +63 −0 bfmatlab/bfGetFileExtensions.m
  7. +114 −0 bfmatlab/bfGetPlane.m
  8. +85 −0 bfmatlab/bfGetReader.m
  9. +54 −0 bfmatlab/bfOpen3DVolume.m
  10. +66 −0 bfmatlab/bfUpgradeCheck.m
  11. +226 −0 bfmatlab/bfopen.m
  12. +143 −0 bfmatlab/bfsave.m
  13. BIN bfmatlab/bioformats_package.jar
  14. +104 −0 bfmatlab/createMinimalOMEXMLMetadata.m
  15. +3 −0 bfmatlab/private/is_octave.m
  16. +161 −0 calibrate3D.m
  17. +207 −0 calibrate3D_GUI.m
  18. +287 −0 calibrate3Daberrations.m
  19. +34 −0 correct_3Daberrations.m
  20. +190,666 −0 data/beads_in_gel_2.csv
  21. BIN data/beadstacks_2D.zip
  22. BIN data/beadstacks_3D_astig.zip
  23. +4,383 −0 data/cme_2um_site_uncorrected_sml.csv
  24. BIN data/single_bead.tif
  25. +326 −0 example_3D_fit.m
  26. +174 −0 private/bsarray.m
  27. +65 −0 private/computeDelta3Dj_v2.m
  28. +4 −0 private/contains.m
  29. +299 −0 private/directFilter.m
  30. +112 −0 private/evalBSpline.m
  31. +66 −0 private/fAt3Dj_v2.m
  32. +374 −0 private/getBSplineFiltCoeffs.m
  33. +19 −0 private/getf0Z_so.m
  34. +22 −0 private/getf0site_so.m
  35. +65 −0 private/getgausscal_so.m
  36. +129 −0 private/getspline_so.m
  37. +296 −0 private/getstackcal_so.m
  38. +59 −0 private/getzfitpar.m
  39. +78 −0 private/images2beads_so.m
  40. +227 −0 private/interp3_0.m
  41. +195 −0 private/registerPSF3D_so.m
  42. +60 −0 private/segmentb_so.m
  43. +44 −0 private/stackas2z2D_so.m
  44. +72 −0 private/stackas2z_so.m
  45. +45 −0 private/symExpFilt.m
  46. BIN shared/CPUmleFit_LM.mexmaci64
  47. BIN shared/CPUmleFit_LM.mexw64
  48. BIN shared/GPUmleFit_LM.mexw64
  49. +997 −0 shared/RegularizeData3D.m
  50. +36 −0 shared/Spline3D_interp.m
  51. BIN shared/connectsingle2c.mexmaci64
  52. BIN shared/connectsingle2c.mexw64
  53. +46 −0 shared/copyfields.m
  54. BIN shared/cudart64_80.dll
  55. +80 −0 shared/get2Dcorrshift.m
  56. +88 −0 shared/get3Dcorrshift.m
  57. +135 −0 shared/maximumfind.c
  58. BIN shared/maximumfind.mexmaci64
  59. BIN shared/maximumfind.mexw64
  60. +24 −0 shared/maximumfindcall.m
  61. +82 −0 shared/mleFit_LM.m
  62. +133 −0 shared/myprctile.m
  63. +60 −0 shared/myquantile.m
  64. +7 −0 shared/myxcorr.m
  65. +15 −0 shared/readfile_ome.m
  66. +154 −0 shared/robustMean.m
  67. +344 −0 shared/selectManyFiles.m
  68. +120 −0 shared/uigetdirs.m
  69. +81 −0 simSplinePSF.m
  70. +1 −0 source/info.txt
  71. +34 −0 sxsy2z.m
BIN +9.91 MB Manuscript_fit3D.pdf
Binary file not shown.
@@ -0,0 +1,16 @@
Terms of Use
Copyright (c) 2017 Ries Lab, European Molecular Biology Laboratory, Heidelberg.
This file is part of GPUmleFit_LM Fitter.
GPUmleFit_LM Fitter 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 3 of the License, or (at your option) any later version.
GPUmleFit_LM Fitter 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 GPUmleFit_LM Fitter. If not, see <http://www.gnu.org/licenses/>.
Additional permission under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or combining it with libraries required for interaction with analysis programs such as Igor Pro or Matlab, the licensors of this Program grant you additional permission to convey the resulting work.
Binary file not shown.
@@ -0,0 +1,54 @@
function [] = bfCheckJavaMemory(varargin)
% bfCheckJavaMemory warn if too little memory is allocated to Java
%
% SYNOPSIS bfCheckJavaMemory()
%
% Input
%
% minMemory - (Optional) The minimum suggested memory setting in MB.
% Default: 512
%
% Output
%
% A warning message is printed if too little memory is allocated.
% OME Bio-Formats package for reading and converting biological file formats.
%
% Copyright (C) 2014 - 2016 Open Microscopy Environment:
% - Board of Regents of the University of Wisconsin-Madison
% - Glencoe Software, Inc.
% - University of Dundee
%
% 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.
runtime = javaMethod('getRuntime', 'java.lang.Runtime');
maxMemory = runtime.maxMemory() / (1024 * 1024);
ip = inputParser;
ip.addOptional('minMemory', 512, @isscalar);
ip.parse(varargin{:});
minMemory = ip.Results.minMemory;
warningID = 'BF:lowJavaMemory';
if maxMemory < minMemory - 64
warning_msg = [...
'*** Insufficient memory detected. ***\n'...
'*** %dm found ***\n'...
'*** %dm or greater is recommended ***\n'...
'*** See http://www.mathworks.com/matlabcentral/answers/92813 ***\n'...
'*** for instructions on increasing memory allocation. ***\n'];
warning(warningID, warning_msg, round(maxMemory), minMemory);
end
@@ -0,0 +1,118 @@
function [status, version] = bfCheckJavaPath(varargin)
% bfCheckJavaPath check Bio-Formats is included in the Java class path
%
% SYNOPSIS bfCheckJavaPath()
% status = bfCheckJavaPath(autoloadBioFormats)
% [status, version] = bfCheckJavaPath()
%
% Input
%
% autoloadBioFormats - Optional. A boolean specifying the action to take
% if no Bio-Formats JAR file is in the Java class path. If true, looks
% for and adds a Bio-Formats JAR file to the dynamic Java path.
% Default - true
%
% Output
%
% status - Boolean. True if a Bio-Formats JAR file is in the Java class
% path.
%
%
% version - String specifying the current version of Bio-Formats if
% a Bio-Formats JAR file is in the Java class path. Empty string else.
% OME Bio-Formats package for reading and converting biological file formats.
%
% Copyright (C) 2012 - 2016 Open Microscopy Environment:
% - Board of Regents of the University of Wisconsin-Madison
% - Glencoe Software, Inc.
% - University of Dundee
%
% 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.
persistent hasBFJarStatic;
% Input check
ip = inputParser;
ip.addOptional('autoloadBioFormats', true, @isscalar);
ip.parse(varargin{:});
% Check if a Bio-Formats JAR file is in the Java class path
% Can be in either static or dynamic Java class path
bfJarFiles = {'bioformats_package.jar', 'loci_tools.jar'};
if(isempty(hasBFJarStatic))
% The static javaclasspath should not change per matlab session
% Therefore, we only need to check it once and can use persistent to
% enforce that
jPathStatic = javaclasspath('-static');
hasBFJarStatic = false(numel(bfJarFiles), 1);
for i = 1: numel(bfJarFiles);
isBFJar = @(x) ~isempty(regexp(x, ['.*' bfJarFiles{i} '$'], 'once'));
hasBFJarStatic(i) = any(cellfun(isBFJar, jPathStatic));
end
end
jPath = javaclasspath('-dynamic');
hasBFJar = hasBFJarStatic;
for i = 1: numel(bfJarFiles);
if(~hasBFJar(i))
isBFJar = @(x) ~isempty(regexp(x, ['.*' bfJarFiles{i} '$'], 'once'));
hasBFJar(i) = any(cellfun(isBFJar, jPath)) ;
end
end
% Check conflicting JARs are not loaded
status = any(hasBFJar);
if all(hasBFJar),
warning('bf:jarConflict', ['Multiple Bio-Formats JAR files found'...
'in the Java class path. Please check.'])
end
if ~status && ip.Results.autoloadBioFormats,
jarPath = getJarPath(bfJarFiles);
assert(~isempty(jarPath), 'bf:jarNotFound',...
'Cannot automatically locate a Bio-Formats JAR file');
% Add the Bio-Formats JAR file to dynamic Java class path
javaaddpath(jarPath);
status = true;
end
if status
% Read Bio-Formats version
if is_octave()
version = char(java_get('loci.formats.FormatTools', 'VERSION'));
else
version = char(loci.formats.FormatTools.VERSION);
end
else
version = '';
end
function path = getJarPath(files)
% Assume the jar is either in the Matlab path or under the same folder as
% this file
for i = 1 : numel(files)
path = which(files{i});
if isempty(path)
path = fullfile(fileparts(mfilename('fullpath')), files{i});
end
if ~isempty(path) && exist(path, 'file') == 2
return
end
end
@@ -0,0 +1,63 @@
function fileExt = bfGetFileExtensions
% bfGetFileExtensions list all extensions supported by Bio-Formats
%
% Synopsis: fileExt = bfGetExtensions()
%
% Input
% none
%
% Output
% fileExt: a cell array of dimensions n x2 where the first colum
% gives the extension and the second the name of the corresponding
% format.
% This cell array is formatted to be used with uigetfile funciton.
% OME Bio-Formats package for reading and converting biological file formats.
%
% Copyright (C) 2012 - 2016 Open Microscopy Environment:
% - Board of Regents of the University of Wisconsin-Madison
% - Glencoe Software, Inc.
% - University of Dundee
%
% 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.
% Get all readers and create cell array with suffixes and names
readers = javaMethod('getReaders', javaObject('loci.formats.ImageReader'));
fileExt = cell(numel(readers), 2);
for i = 1:numel(readers)
suffixes = readers(i).getSuffixes();
if is_octave()
%% FIXME when https://savannah.gnu.org/bugs/?42700 gets fixed
ExtSuf = cell(numel(suffixes), 1);
for j = 1:numel(suffixes)
ExtSuf{j} = char(suffixes(j));
end
fileExt{i, 1} = ExtSuf;
else
fileExt{i, 1} = arrayfun(@char, suffixes, 'Unif', false);
end
fileExt{i, 2} = char(readers(i).getFormat());
end
% Concatenate all unique formats
allExt = unique(vertcat(fileExt{:, 1}));
allExt = allExt(~cellfun(@isempty, allExt));
fileExt = vertcat({allExt, 'All formats'}, fileExt);
% Format file extensions
for i = 1:size(fileExt, 1)
fileExt{i, 1} = sprintf('*.%s;', fileExt{i, 1}{:});
fileExt{i, 1}(end) = [];
end
@@ -0,0 +1,114 @@
function I = bfGetPlane(r, varargin)
% BFGETPLANE Retrieve the plane data from a reader using Bio-Formats
%
% I = bfGetPlane(r, iPlane) returns a specified plane from the input
% format reader. The index specifying the plane to retrieve should be
% contained between 1 and the number of planes for the series. Given a
% set of (z, c, t) plane coordinates, the plane index (0-based) can be
% retrieved using r.getIndex(z, c, t).
%
% I = bfGetPlane(r, iPlane, x, y, width, height) only returns the tile
% which origin is specified by (x, y) and dimensions are specified by
% (width, height).
%
% Examples
%
% I = bfGetPlane(r, 1) % First plane of the series
% I = bfGetPlane(r, r.getImageCount()) % Last plane of the series
% I = bfGetPlane(r, r.getIndex(0, 0, 0) + 1) % First plane of the series
% I = bfGetPlane(r, 1, 1, 1, 20, 20) % 20x20 tile originated at (0, 0)
%
% See also: BFGETREADER
% OME Bio-Formats package for reading and converting biological file formats.
%
% Copyright (C) 2012 - 2016 Open Microscopy Environment:
% - Board of Regents of the University of Wisconsin-Madison
% - Glencoe Software, Inc.
% - University of Dundee
%
% 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.
% Input check
ip = inputParser;
isValidReader = @(x) isa(x, 'loci.formats.IFormatReader') && ...
~isempty(x.getCurrentFile());
ip.addRequired('r', isValidReader);
ip.parse(r);
% Plane check
isValidPlane = @(x) isscalar(x) && ismember(x, 1 : r.getImageCount());
% Optional tile arguments check
isValidX = @(x) isscalar(x) && ismember(x, 1 : r.getSizeX());
isValidY = @(x) isscalar(x) && ismember(x, 1 : r.getSizeY());
ip.addRequired('iPlane', isValidPlane);
ip.addOptional('x', 1, isValidX);
ip.addOptional('y', 1, isValidY);
ip.addOptional('width', r.getSizeX(), isValidX);
ip.addOptional('height', r.getSizeY(), isValidY);
ip.parse(r, varargin{:});
% Additional check for tile size
assert(ip.Results.x - 1 + ip.Results.width <= r.getSizeX(),...
'MATLAB:InputParser:ArgumentFailedValidation',...
'Invalid tile size');
assert(ip.Results.y - 1 + ip.Results.height <= r.getSizeY(),...
'MATLAB:InputParser:ArgumentFailedValidation',...
'Invalid tile size');
% Get pixel type
pixelType = r.getPixelType();
bpp = javaMethod('getBytesPerPixel', 'loci.formats.FormatTools', pixelType);
fp = javaMethod('isFloatingPoint', 'loci.formats.FormatTools', pixelType);
sgn = javaMethod('isSigned', 'loci.formats.FormatTools', pixelType);
little = r.isLittleEndian();
plane = r.openBytes(...
ip.Results.iPlane - 1, ip.Results.x - 1, ip.Results.y - 1, ...
ip.Results.width, ip.Results.height);
% convert byte array to MATLAB image
if sgn
% can get the data directly to a matrix
I = javaMethod('makeDataArray2D', 'loci.common.DataTools', plane, ...
bpp, fp, little, ip.Results.height);
else
% get the data as a vector, either because makeDataArray2D
% is not available, or we need a vector for typecast
I = javaMethod('makeDataArray', 'loci.common.DataTools', plane, ...
bpp, fp, little);
end
% Java does not have explicitly unsigned data types;
% hence, we must inform MATLAB when the data is unsigned
if ~sgn
% NB: arr will always be a vector here
switch class(I)
case 'int8'
I = typecast(I, 'uint8');
case 'int16'
I = typecast(I, 'uint16');
case 'int32'
I = typecast(I, 'uint32');
case 'int64'
I = typecast(I, 'uint64');
end
end
if isvector(I)
% convert results from vector to matrix
shape = [ip.Results.width ip.Results.height];
I = reshape(I, shape)';
end
Oops, something went wrong.

0 comments on commit 1032418

Please sign in to comment.