Skip to content

Commit

Permalink
binning without scaling #18
Browse files Browse the repository at this point in the history
  • Loading branch information
aloejhb committed Jun 16, 2023
1 parent 24a8ae1 commit 412e531
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
6 changes: 3 additions & 3 deletions +batch/binMovieFromFile.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function binConfig = binMovieFromFile(inDir,inFileList,outDir,shrinkFactors,depth,trialOption)
function binConfig = binMovieFromFile(inDir,inFileList,outDir,shrinkFactors,depth,method,trialOption)
% BINMOVIEFROMFILE bin movies from files in a directory
% Args:
% inDir (char): input directory
Expand Down Expand Up @@ -32,9 +32,9 @@
disp(fileName)
filePath = fullfile(inDir,fileName);
trialOptionCell = helper.structToNameValPair(trialOption);
trial = TrialModel(filePath,trialOptionCell{:});
trial = TrialModel('filePath', filePath,trialOptionCell{:});
binned = movieFunc.binMovie(trial.rawMovie,shrinkFactors, ...
'mean');
method);

outFileName = iopath.modifyFileName(fileName,outFilePrefix,'','tif');
outFilePath = fullfile(outDir,outFileName);
Expand Down
16 changes: 10 additions & 6 deletions +movieFunc/convertToUint.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@
depth = 8;
end

if ~exist('zlim','var')
zlim = [min(A(:)), max(A(:))];
if exist('zlim','var')
A = mat2gray(double(A),double(zlim));
if depth == 16
scaler = (2^16 -1);
else
scaler = 255;
end
A = scaler*A;
end

A = mat2gray(double(A),double(zlim));

if depth == 16
A = uint16((2^16 -1)* A);
A = uint16(A);
else
A = uint8(255*A);
A = uint8(A);
end
1 change: 1 addition & 0 deletions NrModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ function binMovieBatch(self,param,outDir,planeNum,fileIdx)
outSubDir,...
param.shrinkFactors,...
param.depth,...
param.method,...
trialOption);
binConfig.outDir = outDir;
binConfig.trialOption = param.trialOption;
Expand Down

0 comments on commit 412e531

Please sign in to comment.