Skip to content
Snippets Groups Projects
Commit 3979e771 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Revert "Enable reconstruction of twinclusters on OAR, using gtSetupReconstruction"

This reverts commit a3e9f983.
parent fabd60e3
No related branches found
No related tags found
No related merge requests found
function cluster = gtLoadCluster(phase_id, cl_or_gr_ids, varargin)
% GTLOADCLUSTER load the projection input of a grain cluster
% cl = function cluster = gtLoadCluster(phase_id, cl_or_gr_ids, varargin)
% INPUT:
% phaseID = <int> phase ID
% cl_or_gr_ids = <int> either the cluster_id (->sample) or
% list of grain_ids composing the
% cluster
%
% OPTIONAL INPUT (p/v pairs):
% fields = <string> only load specific fields from
% cluster structure ('ODF6D', 'SEG')
% parameters = <struct> for security (make sure to load from right directory)
%
function cluster = gtLoadCluster(phase_id, grain_ids, varargin)
conf = struct('fields', {{}}, 'parameters', {[]});
conf = parse_pv_pairs(conf, varargin);
......@@ -21,18 +8,12 @@ function cluster = gtLoadCluster(phase_id, cl_or_gr_ids, varargin)
phase_dir = fullfile(conf.parameters.acq.dir, '4_grains', sprintf('phase_%02d', phase_id));
end
if numel(cl_or_gr_ids) == 1 %if only one element we assume it refers to a cluster
sample = GtSample.loadFromFile;
grain_ids_sorted = sample.phases{phase_id}.clusters(cl_or_gr_ids).included_ids;
else
grain_ids_sorted = sort(cl_or_gr_ids);
if (any(grain_ids_sorted ~= cl_or_gr_ids))
warning('gtLoadCluster:wrong_argumet', ...
'Some grain IDs were no sorted: %s', sprintf(' %d', cl_or_gr_ids));
end
end
grain_ids_sorted = sort(grain_ids);
if (any(grain_ids_sorted ~= grain_ids))
warning('gtLoadCluster:wrong_argumet', ...
'Some grain IDs were no sorted: %s', sprintf(' %d', grain_ids));
end
str_ids = sprintf('_%04d', grain_ids_sorted);
cluster_file = fullfile(phase_dir, sprintf('grain_cluster%s.mat', str_ids));
......
function cluster_rec = gtLoadClusterRec(phase_id, cl_or_gr_ids, varargin)
% GTLOADCLUSTERREC load the 6D reconstruction output of a grain cluster
% cl = function cluster_rec = gtLoadClusterRec(phase_id, cl_or_gr_ids, varargin)
% INPUT:
% phaseID = <int> phase ID
% cl_or_gr_ids = <int> either the cluster_id (->sample) or
% list of grain_ids composing the
% cluster
%
% OPTIONAL INPUT (p/v pairs):
% fields = <string> only load specific fields from
% cluster structure ('ODF6D', 'SEG')
% parameters = <struct> for security (make sure to load from right directory)
%
function cluster_rec = gtLoadClusterRec(phase_id, grain_ids, varargin)
conf = struct('fields', {{}}, 'parameters', {[]});
conf = parse_pv_pairs(conf, varargin);
......@@ -22,15 +8,11 @@ function cluster_rec = gtLoadClusterRec(phase_id, cl_or_gr_ids, varargin)
phase_dir = fullfile(conf.parameters.acq.dir, '4_grains', sprintf('phase_%02d', phase_id));
end
if numel(cl_or_gr_ids) == 1 %only one element - it refers to a cluster
sample = GtSample.loadFromFile;
grain_ids_sorted = sample.phases{phase_id}.clusters(cl_or_gr_ids).included_ids;
else
grain_ids_sorted = sort(cl_or_gr_ids);
if (any(grain_ids_sorted ~= cl_or_gr_ids))
warning('gtLoadCluster:wrong_argumet', ...
'Some grain IDs were no sorted: %s', sprintf(' %d', cl_or_gr_ids));
end
grain_ids_sorted = sort(grain_ids);
if (any(grain_ids_sorted ~= grain_ids))
warning('gtLoadCluster:wrong_argumet', ...
'Some grain IDs were no sorted: %s', sprintf(' %d', grain_ids));
end
str_ids = sprintf('_%04d', grain_ids_sorted);
......
function gtReconstructGrainTwinCluster(phase_id, cluster_id, workingdirectory, parameters, varargin)
function gtReconstructGrainTwinCluster(grain_ids, phase_id, parameters, varargin)
% gtReconstructGrainOrientation 6D reconstructions on a GPU machine
% gtReconstructGrainTwinCluster(phase_id, cluster_id, workingdirectory, parameters, varargin)
% gtAstraReconstructGrain(grainIDs, phaseID, [parameters])
% -------------------------------------------------------
cd(workingdirectory);
if (isdeployed)
global GT_DB %#ok<NUSED,TLEV>
global GT_MATLAB_HOME %#ok<NUSED,TLEV>
load('workspaceGlobal.mat');
phase_id = str2double(phase_id);
cluster_id = str2double(cluster_id);
end
sample = GtSample.loadFromFile;
grain_ids = sample.phases{phase_id}.clusters(cluster_id).included_ids;
if (~exist('parameters', 'var') || isempty(parameters))
parameters = gtLoadParameters();
end
......@@ -163,3 +150,4 @@ function gtReconstructGrainTwinCluster(phase_id, cluster_id, workingdirectory, p
save(grain_full_details_file, 'ODF6D', '-v7.3');
end
end
function gtSetupReconstruction(phaseID, varargin)
function gtSetupReconstruction(phaseID, list)
% GTSETUPRECONSTRUCTION Simple helper function to launch reconstruction and segmentation of
% absorption volume - as well as reconstruction and segmentation of grain volumes
%
% gtSetupReconstruction(phaseID, varargin)
% gtSetupReconstruction(phaseID, list)
% ------------------------------
%
% INPUT:
% phaseID = number of the phase <double> {1}
% list = vector of grainids, default value is {[1: num_grains]}
%
% OPTIONAL INPUT:
% grain_ids = vector of grain_ids, default value is {[1: num_grains]}
% cluster_ids = vector of cluster_ids, default value is {[1: num_clusters]}
% 'is_cluster
% Version 005 12-10-2016 by W. Ludwig
% Add possibility to launch grain-cluster reconstructions
% Version 004 25-05-2016 by W. Ludwig
% Add possibility to specify a list of grainids - which will be
% handled by OAR
......@@ -28,12 +23,6 @@ function gtSetupReconstruction(phaseID, varargin)
% Move gtModifyStructure to before the abs reconstruction is done.
GPU_OK = gtCheckGpu();
conf.grain_ids = [];
conf.cluster_ids = [];
if (~isempty(varargin))
conf = parse_pv_pairs(conf, varargin);
end
if (~GPU_OK)
disp('Not on a GPU machine, you won''t be able to reconstruct localy!');
......@@ -68,7 +57,7 @@ gtSaveParameters(parameters);
nof_phases = numel(parameters.cryst);
if (nof_phases > 1) && isempty(phaseID)
if (nof_phases > 1)
phaseID = inputwdefaultnumeric('Enter phaseID', num2str(1));
end
phaseID_str = sprintf('%02d', phaseID);
......@@ -139,21 +128,16 @@ else
end
end
% If input parameter grain_ids is empty, we will use all grains by default
% If input parameter list is empty, we will use all grains by default
first = 1;
last = sample.phases{phaseID}.getNumberOfGrains();
if ~isempty(varargin)
conf = parse_pv_pairs(conf, varargin);
if (~exist('list', 'var') || isempty(list))
list = [first : last];
end
if isempty(conf.grain_ids)
first = 1;
last = sample.phases{phaseID}.getNumberOfGrains();
list = [first : last];
end
check = inputwdefault('Launch grain reconstruction? [y/n]', 'y');
check = inputwdefault('Launch reconstruction? [y/n]', 'y');
rec_on_OAR = false;
if strcmpi(check, 'y')
if (GPU_OK)
......@@ -164,35 +148,13 @@ if strcmpi(check, 'y')
end
if (rec_on_OAR)
launch_on_OAR('gtReconstructGrains', first, last, phaseID_str, ...
parameters, 'njobs', 8, 'walltime', 3600 * 16, ...
'gpu', true, 'distribute', true, 'list', list);
parameters, 'njobs', 8, 'walltime', 3600 * 16, ...
'gpu', true, 'distribute', true, 'list', list);
else
gtReconstructGrains(first, last, parameters.acq.dir, phaseID, parameters, 'list', list);
end
end
if ~isempty(conf.cluster_ids)
list = conf.cluster_ids;
check = inputwdefault('Launch cluster reconstruction? [y/n]', 'y');
rec_on_OAR = false;
if strcmpi(check, 'y')
if (GPU_OK)
check2 = inputwdefault('Launch grain reconstruction via OAR? [y/n]', 'y');
rec_on_OAR = strcmpi(check2, 'y');
else
rec_on_OAR = true;
end
if (rec_on_OAR)
launch_on_OAR('gtReconstructGrainTwinClusters', first, last, phaseID_str, ...
parameters, 'njobs', 8, 'walltime', 3600 * 16, ...
'gpu', true, 'distribute', true, 'list', list);
else
gtReconstructGrainTwinClusters(first, last, parameters.acq.dir, phaseID, parameters, 'list', list);
end
end
end
if (~rec_on_OAR)
check = inputwdefault('Launch grain segmentation? [y/n]', 'y');
if strcmpi(check, 'y')
......
......@@ -47,9 +47,6 @@
<function name="gtReconstructGrains">
<path absolute="false">5_reconstruction/gtReconstructGrains.m</path>
</function>
<function name="gtReconstructGrainTwinClusters">
<path absolute="false">5_reconstruction/gtReconstructGrainTwinClusters.m</path>
</function>
<function name="gtForwardSimulate_v2">
<path absolute="false">zUtil_ForwardSim/gtForwardSimulate_v2.m</path>
</function>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment