Skip to content
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

Use cell- instead of char- array to accommodate filenames of unequal length in RFsens #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Barisevrenugur
Copy link
Contributor

@Barisevrenugur Barisevrenugur commented Nov 5, 2024

Background

As standard, the files appear with same lengths as block-names (all of our test data has same file names formatted as a block). However, certain operations (BIDSification for one) might cause file names to differ. In such a case, the following line in RFsens correction causes an error further down the processing:

jobsubj.raw_mpm.(rfsens_params.input(ccon).tag) = char(corrected_structurals);

because of using a char-array instead of a cell-array.

This minimal change solves this problem.

Testing

This simple change was tested successfully with our demo-data set with the changed MTw file names as:

"pathtoMTw/anon-1_RFSC.nii",
"pathtoMTw/anon-2_RFSC.nii",
"pathtoMTw/anon-3_RFSC.nii",
"pathtoMTw/anon-4_RFSC.nii",
"pathtoMTw/anon-5_RFSC.nii",
"pathtoMTw/anon-6_RFSC.nii"

Namely: the toolbox without the change in this PR gives an error whereas this PR completes the processing without a problem.

Reference

This PR implements the change suggested here:

#107 (comment)

@Barisevrenugur Barisevrenugur linked an issue Nov 5, 2024 that may be closed by this pull request
@Barisevrenugur Barisevrenugur changed the title use cell- instead of char- array to accommodate non-standard file names in RFsens Use cell- instead of char- array to accommodate non-standard file names in RFsens Nov 5, 2024
@Barisevrenugur Barisevrenugur added enhancement New feature or request bug Something isn't working labels Nov 5, 2024
@@ -95,7 +95,7 @@
copyfile(qsensmap,fullfile(supplpath,spm_file(qsensmap,'filename')));
try copyfile([spm_str_manip(qsensmap,'r') '.json'],fullfile(supplpath,[spm_file(qsensmap,'basename'), '.json'])); end %#ok<*TRYNC>
% substitute the corrected maps to the output structure
jobsubj.raw_mpm.(rfsens_params.input(ccon).tag) = char(corrected_structurals);
jobsubj.raw_mpm.(rfsens_params.input(ccon).tag) = cellstr(char(corrected_structurals));
Copy link
Member

@lukeje lukeje Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does

jobsubj.raw_mpm.(rfsens_params.input(ccon).tag) = corrected_structurals;

not work?

Copy link
Contributor Author

@Barisevrenugur Barisevrenugur Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to nature of error, I was fixated to quickly correcting char ---> cell, have not really checked or cared what data type is corrected_structurals, if it is already a cell-array, of course it should just work to delete the char (instead of adding cellstr). I will change if thats the case

@lukeje lukeje changed the title Use cell- instead of char- array to accommodate non-standard file names in RFsens Use cell- instead of char- array to accommodate filenames of unequal length in RFsens Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Char incompatibility size
2 participants