Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Established convention for docstrings #145

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 39 additions & 12 deletions +imutils/dicom_to_nifti.m
Original file line number Diff line number Diff line change
@@ -1,14 +1,41 @@
function dicom_to_nifti( unsortedDicomDir, niftiPath )
%DICOM_TO_NIFTI converts dicoms into niftis with dcm2bids output
function dicom_to_nifti(unsortedDicomDir, niftiPath)
%% DICOM_TO_NIFTI converts DICOM data to organized NIfTI files.
%
% This function uses <https://github.com/cbedetti/Dcm2Bids dcm2bids> to
% convert all DICOM files within a directory, into NIfTI
%
% SYNTAX:
%
% dicom_to_nifti(unsortedDicomDir, niftiPath)
%
% dicom_to_nifti( unsortedDicomDir, niftiPath )
% INPUTS:
%
% The input `unsortedDicomDir` is a path to a folder containing either be
% ".dcm" or ".IMA". The input `iftiPath`is a folder for the output.
% unsortedDicomDir (str):
% Path to a folder containing either be ".dcm" or ".IMA".
%
% niftiPath (str):
% Output folder that will enclose the converted NIfTI files.
%
% The output will be niftis in seperate folders according to their
% acquisition names that are in `niftiPath`.

% OUTPUTS:
%
% None
%
% EXAMPLE:
%
% dicom_to_nifti('/home/bob/data_dicom', '/home/bob/data_nii_bids')
%
% DEPENDENCIES:
%
% <https://github.com/cbedetti/Dcm2Bids dcm2bids>
%
% <https://github.com/rordenlab/dcm2niix dcm2niix>
%
% AUTHORS:
%
% Ryan Topfer <[email protected]>
%
% Alexandre D'Astous <[email protected]>
%%
mkdir(niftiPath);
disp(unsortedDicomDir);
disp(niftiPath);
Expand Down Expand Up @@ -109,11 +136,11 @@ function dicom_to_nifti( unsortedDicomDir, niftiPath )
end

end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Local functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


function filePath = createConfig(outputDir, acquisitionNumber, acquisitionName, modality)

% Create config for blablabla (to be continued...)

% Create names
name = [acquisitionNumber '_' acquisitionName];
ext = '.json';
Expand Down
14 changes: 8 additions & 6 deletions external/genToolboxHelp.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@
% August 2015; Last revision: 31-Aug-2015
% Copyright 2014-2015 Johannes Milvich
%------------- BEGIN CODE --------------%

global MAKECONTENTSFILES; MAKECONTENTSFILES = false; % Create Contents.m file within each folder.
global FOLDERHTML; FOLDERHTML = 'html'; % Folder name for output html files.
global PUBLISHSHOWCODE; PUBLISHSHOWCODE = false; % show code in published html

%% 1) Initialisation
% Check inputs - if no ignored folders are specified, only the default ones
% (.git and the Help folder itself) are ignored. By default, the code is not
% evaluated for the published .m files and a searchable database is
% created. Also check if the specified ToolBoxpath exists.
global MAKECONTENTSFILES
MAKECONTENTSFILES = false; % Create Contents.m file within each folder.
global FOLDERHTML
FOLDERHTML = 'html'; % Folder name for output html files.

if nargin<3
IgnoredFolders = {};
Expand Down Expand Up @@ -637,12 +638,13 @@
% email address: [email protected]
% August 2015; Last revision: 31-Aug-2015
% Copyright 2014-2015 Johannes Milvich
global PUBLISHSHOWCODE
help_file_name = strrep(strrep(m_file_name,rootDir,''),'.m','.html');
help_file_name_fp = fullfile(help_folder_name,help_file_name);
if ~exist(help_file_name_fp,'file')
% If a helpfile of that name does not exist yet, directly
% publish it to the right folder
publish(m_file_name, 'format','html','outputDir',help_folder_name,'evalCode',false);
publish(m_file_name, 'format','html','outputDir',help_folder_name,'evalCode',false, 'showCode', PUBLISHSHOWCODE);
status = 1;
else
% If a helpfile of that name already exists, publish to a
Expand All @@ -652,7 +654,7 @@
% keep the old one
tmp_folder = fullfile(help_folder_name,'tmp');
mkdir(tmp_folder);
tmp_help_file_name_fp = publish(m_file_name, 'format','html','outputDir',tmp_folder,'evalCode',false);
tmp_help_file_name_fp = publish(m_file_name, 'format','html','outputDir',tmp_folder,'evalCode',false, 'showCode', PUBLISHSHOWCODE);

[status,~] = system(['fc ' tmp_help_file_name_fp ' ' help_file_name_fp]);
if status
Expand Down