Skip to content

[ENH] Bump bids matlab #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 28, 2022
Merged
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
2 changes: 0 additions & 2 deletions .github/workflows/miss_hit_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools
pip3 install -r requirements.txt
cd tests
make data

- name: MISS_HIT Metrics
run: |
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/miss_hit_style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- master
- dev
pull_request:
branches: '*'
branches: ['*']

jobs:
build:
Expand All @@ -30,8 +30,6 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools
pip3 install -r requirements.txt
cd tests
make data

- name: MISS_HIT Code style
run: |
Expand Down
30 changes: 23 additions & 7 deletions src/roi/get_ROI_Coordinates.m → demos/WIP/get_ROI_Coordinates.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
function mni = get_ROI_Coordinates
% This function gets the individual subject coordniates of the highest peak
% within a specified Region of interest (usually coming from the group level univariate analysis)

% within a specified Region of interest (usually coming
% from the group level univariate analysis)
%
% Critical t-value for each experimental condition or mask file
CriticalTs = 1; % Critical t-value for visual condition in L-V5 and R-V5 and bilateral PT
% Critical t-value for visual condition in L-V5 and R-V5 and bilateral PT
%
% (C) Copyright 2021 CPP ROI developers

CriticalTs = 1;

%% load the data structure
WD = pwd;
Expand Down Expand Up @@ -52,9 +57,17 @@
%% the first 4 masks are for the FACE condition, the other 4
% are from the SCENE condition
if iMask <= 2
result_file = [data_path, '/', SubName, '/stats/ffx_visMotion/ffx_', smoothing, '/spmT_0013.nii']; % HUMAN > BIG_ENV
result_file = [data_path, '/', ...
SubName, ...
'/stats/ffx_visMotion/ffx_', ...
smoothing, ...
'/spmT_0013.nii']; % HUMAN > BIG_ENV
else
result_file = [data_path, '/', SubName, '/stats/ffx_audMotion/ffx_', smoothing, '/spmT_0014.nii']; % BIG_ENV > HUMAN
result_file = [data_path, '/', ...
SubName, ...
'/stats/ffx_audMotion/ffx_', ...
smoothing, ...
'/spmT_0014.nii']; % BIG_ENV > HUMAN
end

%%
Expand All @@ -78,8 +91,11 @@

% convert space from slice number to mni
mni{1, iMask}(subCounter, :) = cor2mni([x y z], mask_path);
% mni{1,iMask}(iSub,1) = mni{1,iMask}(iSub,1)* -1; % If masks created from AFNI or FSL,
% the x coordinate could be flipped (multiplied x -1). If this is the case, multiply x with -1.

% mni{1,iMask}(iSub,1) = mni{1,iMask}(iSub,1)* -1;
% If masks created from AFNI or FSL,
% the x coordinate could be flipped (multiplied x -1).
% If this is the case, multiply x with -1.

mni{1, iMask}(subCounter, :);

Expand Down
5 changes: 0 additions & 5 deletions docs/CONTRIBUTING.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ help:
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)


doc:
@$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)"
7 changes: 2 additions & 5 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,15 @@
author = "the CPP ROI dev team"

# The full version, including alpha/beta/rc tags
release = "v0.1.0"
release = "v0.1.0dev"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinxcontrib.matlab',
'sphinx.ext.autodoc',
'sphinx_copybutton']
extensions = ["sphinxcontrib.matlab", "sphinx.ext.autodoc", "sphinx_copybutton"]
matlab_src_dir = os.path.dirname(os.path.abspath("../../src"))
primary_domain = "mat"

Expand Down
2 changes: 1 addition & 1 deletion tests/run_tests.m → run_tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

spm('defaults', 'fMRI');

testFolder = fullfile(fileparts(mfilename('fullpath')));
testFolder = fullfile(fileparts(mfilename('fullpath')), 'tests');

folderToCover = fullfile(testFolder, '..', 'src');

Expand Down
2 changes: 1 addition & 1 deletion src/atlas/extractRoiByLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
outputVol(vol == labelStruct.label) = true;

p = bids.internal.parse_filename(sourceImage);
p.entities.label = labelStruct.ROI;
p.entities.label = bids.internal.camel_case(labelStruct.ROI);
p.suffix = 'mask';

bidsFile = bids.File(p);
Expand Down
2 changes: 1 addition & 1 deletion src/roi/renameNeuroSynth.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

basename = spm_file(inputImage, 'basename');
parts = strsplit(basename, '_');
p.entities.label = ['neurosynth ' parts{1}];
p.entities.label = bids.internal.camel_case(['neurosynth ' parts{1}]);

bidsFile = bids.File(p);

Expand Down
2 changes: 1 addition & 1 deletion src/roi/thresholdToMask.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
p = bids.internal.parse_filename(inputImage);

p.suffix = 'mask';

% add peakThreshold and clusterSizeInfo to desc
if ~isfield(p.entities, 'desc')
p.entities.desc = '';
Expand Down
31 changes: 25 additions & 6 deletions src/utils/renameFile.m
Original file line number Diff line number Diff line change
@@ -1,24 +1,43 @@
function newName = renameFile(inputFile, specification)
%
% Renames a BIDS valid file into another BIDS valid file given some
% specification.
% specificationification.
%
% USAGE::
%
% newName = renameFile(inputFile, specification)
% newName = renameFile(inputFile, specificationification)
%
% :param inputFile: better if fullfile path
% :type inputFile: string
% :param specification: structure specifying the details of the new name
% :param specificationification: structure specificationifying the details of the new name
% The structure content must resemble that of the
% output of bids.internal.parse_filename
% :type specification: structure
% :type specificationification: structure
%
% (C) Copyright 2021 CPP ROI developers

bidsFile = bids.File(inputFile, false, specification);
newName = bidsFile.filename;
bf = bids.File(inputFile, 'use_schema', false);

if isfield(specification, 'prefix')
bf.suffix = specification.prefix;
end
if isfield(specification, 'suffix')
bf.suffix = specification.suffix;
end
if isfield(specification, 'ext')
bf.extension = specification.ext;
end
if isfield(specification, 'entities')
entities = fieldnames(specification.entities);
for i = 1:numel(entities)
bf = bf.set_entity(entities{i}, ...
bids.internal.camel_case(specification.entities.(entities{i})));
end
end

bf = bf.update;

newName = bf.filename;
outputFile = spm_file(inputFile, 'filename', newName);

movefile(inputFile, outputFile);
Expand Down
Empty file.
4 changes: 2 additions & 2 deletions tests/test_extractRoiFromAtlas.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function test_extractRoiFromAtlas_wang()

roiImage = extractRoiFromAtlas(pwd, 'wang', 'V1v', 'L');

assertEqual(exist(fullfile(pwd, 'space-MNI_hemi-L_label-V1v_desc-wang_mask.nii'), ...
assertEqual(exist(fullfile(pwd, 'hemi-L_space-MNI_label-V1v_desc-wang_mask.nii'), ...
'file'), ...
2);

Expand All @@ -29,7 +29,7 @@ function test_extractRoiFromAtlas_neuromorphometrics()
roiImage = extractRoiFromAtlas(pwd, 'neuromorphometrics', 'Amygdala', 'L');

assertEqual(exist(fullfile(pwd, ...
'space-MNI_hemi-L_label-Amygdala_desc-neuromorphometrics_mask.nii'), ...
'hemi-L_space-MNI_label-Amygdala_desc-neuromorphometrics_mask.nii'), ...
'file'), ...
2);

Expand Down