Skip to content

Conversation

@MichaelStritt
Copy link
Contributor

@MichaelStritt MichaelStritt commented Aug 4, 2021

Linked issue

#762

Comments

@BeatrizPadrela & @HenkMutsaerts: would be cool if you would test this to validate that it's working correctly.

@MichaelStritt MichaelStritt added the bug Something isn't working label Aug 4, 2021
@MichaelStritt MichaelStritt linked an issue Aug 4, 2021 that may be closed by this pull request
Copy link
Member

@HenkMutsaerts HenkMutsaerts left a comment

Choose a reason for hiding this comment

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

Would resort to 'n/a', otherwise good!

for iColumn=1:size(TSV,2)
% Remove lists (we had a problem where it was tried to insert SliceTiming arrays into the table)
if size(TSV{iRow,iColumn},1)>1
TSV{iRow,iColumn} = 'n/a';
Copy link
Member

Choose a reason for hiding this comment

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

But shouldn't this produce a warning? The pipeline should never suddenly introduce lists inside one cell. This could be the case in the import module, but not in the other modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They could be defined manually though. I only encountered this once, but for multiple visits/subjects you could potentially get a LOT of warnings

Copy link
Member

Choose a reason for hiding this comment

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

Sure, then we can keep track of the warning and limit the number of its outputs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a warning for now, let's see how it turns out fd9f2f4

Copy link
Contributor

Choose a reason for hiding this comment

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

I have an alternative solution for more transparency. If there's a list, then report it is a list instead of "n/a". You can either print "list" or "field1, field2,..."

end
% Remove empty elements (Empty cells in the TSV can lead to reading errors)
if isempty(TSV{iRow,iColumn})
TSV{iRow,iColumn} = '_';
Copy link
Member

Choose a reason for hiding this comment

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

Why the underscore? Why not 'n/a' like in the other cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because we write this table where we have empty places and if we write '' to the cell array some tsv readers crash. We did this before and it looks quite okay I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have things like:
row description COLUMN 1 COLUMN2 COLUMN 3
row description value value value
row description EMPTYCOLUMN COLUMN 1 COLUMN2
row description _ value value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't like it, but for that use case it's the cleanest solution IMHO

Copy link
Member

Choose a reason for hiding this comment

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

I like this strategy, I just think that '_' is arbitrary, whereas BIDS defaults to 'n/a' for missing values. So it seems we should use this as well right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I introduced the '_' only for these placeholder cells that you used in these combined tables. All the numerical values should be defaulted to 'n/a'. Check out the example below:

image

Copy link
Contributor

Choose a reason for hiding this comment

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

I am fine with that. I would merge as is and change in the future if we find this weird. Unless Henk has a different opinion.

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see, nice. So all missing values, irrespective their meaning/format, will be 'n/a', according to BIDS. Only the empty placeholder cells will be an underscore '_', that looks good.

for iColumn=1:size(TSV,2)
% Remove lists (we had a problem where it was tried to insert SliceTiming arrays into the table)
if size(TSV{iRow,iColumn},1)>1
TSV{iRow,iColumn} = 'n/a';
Copy link
Member

Choose a reason for hiding this comment

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

Sure, then we can keep track of the warning and limit the number of its outputs

@MichaelStritt
Copy link
Contributor Author

@jan-petr could you check this out while Henk is on vacation?

Copy link
Contributor

@jan-petr jan-petr left a comment

Choose a reason for hiding this comment

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

See my comments. Let's have a final consensus with Henk. But in principle, we can merge.

for iColumn=1:size(TSV,2)
% Remove lists (we had a problem where it was tried to insert SliceTiming arrays into the table)
if size(TSV{iRow,iColumn},1)>1
TSV{iRow,iColumn} = 'n/a';
Copy link
Contributor

Choose a reason for hiding this comment

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

I have an alternative solution for more transparency. If there's a list, then report it is a list instead of "n/a". You can either print "list" or "field1, field2,..."

end
% Remove empty elements (Empty cells in the TSV can lead to reading errors)
if isempty(TSV{iRow,iColumn})
TSV{iRow,iColumn} = '_';
Copy link
Contributor

Choose a reason for hiding this comment

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

I am fine with that. I would merge as is and change in the future if we find this weird. Unless Henk has a different opinion.

end
% Remove empty elements (Empty cells in the TSV can lead to reading errors)
if isempty(TSV{iRow,iColumn})
TSV{iRow,iColumn} = '_';
Copy link
Member

Choose a reason for hiding this comment

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

Ah I see, nice. So all missing values, irrespective their meaning/format, will be 'n/a', according to BIDS. Only the empty placeholder cells will be an underscore '_', that looks good.

@MichaelStritt MichaelStritt force-pushed the bug-#762_FixCellArrays branch from fd9f2f4 to add6a58 Compare August 17, 2021 12:37
@MichaelStritt MichaelStritt merged commit add6a58 into develop Aug 17, 2021
@MichaelStritt MichaelStritt deleted the bug-#762_FixCellArrays branch August 17, 2021 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xASL_stat_GetDICOMStatistics: bug with arrays in cell arrays

5 participants