Skip to content

Commit

Permalink
new solution for romeo suggested by Korbinian
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwok-Shing Chan committed Oct 12, 2023
1 parent 48345eb commit e1a4f74
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 46 deletions.
26 changes: 3 additions & 23 deletions addons/echo_combine/romeo/Wrapper_TotalField_ROMEO.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,7 @@

%% check shared library
% 20231009: KC libraries with potential known issue
if ~ispc
filepath = fileparts( which('ROMEO.m'));
libunwind_file = fullfile(filepath,'..','lib','julia','libunwind.so');
libstdcpp_file = fullfile(filepath,'..','lib','julia','libstdc++.so.6');
libgccs_file = fullfile(filepath,'..','lib','julia','libgcc_s.so.1');
LD_PRELOAD_path = getenv('LD_PRELOAD');
LD_PRELOAD_path_original = LD_PRELOAD_path;
if ~contains(LD_PRELOAD_path,libunwind_file)
setenv('LD_PRELOAD',strcat(LD_PRELOAD_path,':',libunwind_file));
LD_PRELOAD_path = getenv('LD_PRELOAD');
end
if ~contains(LD_PRELOAD_path,libstdcpp_file)
setenv('LD_PRELOAD',strcat(LD_PRELOAD_path,':',libstdcpp_file));
LD_PRELOAD_path = getenv('LD_PRELOAD');
end
if ~contains(LD_PRELOAD_path,libgccs_file)
setenv('LD_PRELOAD',strcat(LD_PRELOAD_path,':',libgccs_file));
end
end
if isunix; paths = getenv('LD_LIBRARY_PATH'); setenv('LD_LIBRARY_PATH'); end

%% main
[fieldmapUnwrapAllEchoes, totalField] = ROMEO(wrappedField, parameters);
Expand Down Expand Up @@ -93,10 +75,8 @@
totalField(isnan(totalField)) = 0;
totalField(isinf(totalField)) = 0;

% restore LD_PRELOAD environment
if ~ispc
setenv('LD_PRELOAD',LD_PRELOAD_path_original);
end
% restore LD_LIBRARY_PATH environment
if isunix; setenv('LD_LIBRARY_PATH', paths); end

end

Expand Down
26 changes: 3 additions & 23 deletions addons/phase_unwrap/romeo/Wrapper_Unwrap_ROMEO_singleEcho.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,7 @@

%% check shared library
% 20231009: KC libraries with potential known issue
if ~ispc
filepath = fileparts( which('ROMEO.m'));
libunwind_file = fullfile(filepath,'..','lib','julia','libunwind.so');
libstdcpp_file = fullfile(filepath,'..','lib','julia','libstdc++.so.6');
libgccs_file = fullfile(filepath,'..','lib','julia','libgcc_s.so.1');
LD_PRELOAD_path = getenv('LD_PRELOAD');
LD_PRELOAD_path_original = LD_PRELOAD_path;
if ~contains(LD_PRELOAD_path,libunwind_file)
setenv('LD_PRELOAD',strcat(LD_PRELOAD_path,':',libunwind_file));
LD_PRELOAD_path = getenv('LD_PRELOAD');
end
if ~contains(LD_PRELOAD_path,libstdcpp_file)
setenv('LD_PRELOAD',strcat(LD_PRELOAD_path,':',libstdcpp_file));
LD_PRELOAD_path = getenv('LD_PRELOAD');
end
if ~contains(LD_PRELOAD_path,libgccs_file)
setenv('LD_PRELOAD',strcat(LD_PRELOAD_path,':',libgccs_file));
end
end
if isunix; paths = getenv('LD_LIBRARY_PATH'); setenv('LD_LIBRARY_PATH'); end

%% main
[unwrappedField, ~] = ROMEO(wrappedField, parameters);
Expand All @@ -71,10 +53,8 @@
% Remove all temp output files and the temp folder
rmdir(parameters.output_dir, 's')

% restore LD_PRELOAD environment
if ~ispc
setenv('LD_PRELOAD',LD_PRELOAD_path_original);
end
% restore LD_LIBRARY_PATH environment
if isunix; setenv('LD_LIBRARY_PATH', paths); end

end

Expand Down

0 comments on commit e1a4f74

Please sign in to comment.