Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 1aa8f1cf authored by Elian Dib's avatar Elian Dib
Browse files

WIP

parent 438f0d6f
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,34 @@ function [data,cmap,alpha] = fromSubAps(Dir,varargin) ...@@ -2,6 +2,34 @@ function [data,cmap,alpha] = fromSubAps(Dir,varargin)
%FROMSUBAPS Read and reconstruct lightfield from subapertures %FROMSUBAPS Read and reconstruct lightfield from subapertures
% data = fromSubAps(Dir,varargin) % data = fromSubAps(Dir,varargin)
% Decide to process current directory or subdirectory
folders = dir(Dir);
files = {folders(~[folders.isdir]).name};
folders = {folders([folders.isdir]).name};
folders = folders(3:end);
labels = cellfun(@str2double,folders);
folders = folders(~isnan(labels));
labels = labels(~isnan(labels));
if isempty(files)
if ~any(labels)
error('No files found in directory');
end
warning('No files found in directory, trying subdirectories');
data = cell(1,numel(folders));
cmap = cell(1,numel(folders));
alpha = cell(1,numel(folders));
for lab = labels
[data{lab},cmap{lab},alpha{lab}] = LF.fromSubAps(...
fullfile(Dir,folders{lab==labels}),varargin{:});
end
return;
end
% Parse input parameters % Parse input parameters
p = inputParser; p.KeepUnmatched = true; p.StructExpand = true; p = inputParser; p.KeepUnmatched = true; p.StructExpand = true;
p.addParameter('name' , '' , @ischar); p.addParameter('name' , '' , @ischar);
......
...@@ -12,6 +12,12 @@ ext = p.Results.ext; ...@@ -12,6 +12,12 @@ ext = p.Results.ext;
data = LF.fromSubAps(Dir,'ext',ext,'zero_ind',true,varargin{:}); data = LF.fromSubAps(Dir,'ext',ext,'zero_ind',true,varargin{:});
% Reorder dimensions % Reorder dimensions
data = permute(flip(flip(data,4),5),[1,2,3,5,4]); if iscell(data)
for lab = 1:numel(data)
data{lab} = permute(flip(flip(data{lab},4),5),[1,2,3,5,4]);
end
else
data = permute(flip(flip(data,4),5),[1,2,3,5,4]);
end
end end
\ No newline at end of file
...@@ -2,6 +2,14 @@ function toSubAps(data,Dir,varargin) ...@@ -2,6 +2,14 @@ function toSubAps(data,Dir,varargin)
%TOSUBAPS Write lightfield as subapertures %TOSUBAPS Write lightfield as subapertures
% toSubAps(data,Dir,varargin) % toSubAps(data,Dir,varargin)
if iscell(data)
for lab = 1:numel(data)
LF.toSubAps(data{lab},fullfile(Dir,num2str(lab)),varargin{:});
end
return;
end
mask = true(size(data,4),size(data,5)); mask = true(size(data,4),size(data,5));
maxValue = []; maxValue = [];
if isinteger(data); maxValue = intmax(class(data)); end if isinteger(data); maxValue = intmax(class(data)); end
......
...@@ -2,6 +2,14 @@ function toSubApsPleno(data,Dir,varargin) ...@@ -2,6 +2,14 @@ function toSubApsPleno(data,Dir,varargin)
%TOSUBAPSPLENO Summary of this function goes here %TOSUBAPSPLENO Summary of this function goes here
% Detailed explanation goes here % Detailed explanation goes here
if iscell(data)
for lab = 1:numel(data)
LF.toSubApsPleno(data{lab},fullfile(Dir,num2str(lab)),varargin{:});
end
return;
end
% Set default extension according to number of channels % Set default extension according to number of channels
switch size(data,3) switch size(data,3)
case 3 case 3
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment