Skip to content

Fixes #827 xASL_module_Population: avoid running parallelized#838

Merged
MichaelStritt merged 11 commits intodevelopfrom
bug-#827_Population_Parallel
Sep 27, 2021
Merged

Fixes #827 xASL_module_Population: avoid running parallelized#838
MichaelStritt merged 11 commits intodevelopfrom
bug-#827_Population_Parallel

Conversation

@HenkMutsaerts
Copy link
Member

Linked issue

Closes #827

Copy link
Contributor

@MichaelStritt MichaelStritt left a comment

Choose a reason for hiding this comment

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

Seems good to me 👍
Did you test it?

Edit: during the last release we agreed on describing how to test and/or to show a small test that you ran, so that we do not have to fix that many bugs during the release

Edit2: please also fill in the release notes

@MichaelStritt MichaelStritt added the bug Something isn't working label Sep 14, 2021
@MichaelStritt MichaelStritt self-requested a review September 15, 2021 12:31
@MichaelStritt
Copy link
Contributor

@HenkMutsaerts: I did some minor changes:

  • Simplifications: Writing fprintf('%s\n', text) is kind of unnecessary if there is no variable, we can write fprintf('text\n') instead (ed968c4, 973eb76)
  • Legacy code: For the initialization and import I've tried to put more and more legacy code that will be removed with 2.0.0 to separate subfunctions, so that we can get rid of that more easily in the future. I did the same here, but we should still test this (b8e6514).
  • Existence check: I added 'file' here, to help other developers who read the code (c65d45c).

Do you know a nice way to test all of this?

@MichaelStritt MichaelStritt changed the title #827 xASL_module_Population: avoid running parallelized Fixes #827 xASL_module_Population: avoid running parallelized Sep 24, 2021
@HenkMutsaerts
Copy link
Member Author

HenkMutsaerts commented Sep 25, 2021

Nice!

  • Moving legacy code to a separate function: I don't know from the top of my head if this is all legacy code that can be skipped, or if it should be replaced with something. And it needs to be carefully tested indeed, but I don't how all the use cases, there are too many :) So unless you know exactly how to test this in all examples, I would revert this subfunction.
  • I like it that we can have "minor" and "super minor" -> reminder for when you write papers: when you write a paper, you don't want to use superlatives when not needed.

@MichaelStritt
Copy link
Contributor

Moving legacy code to a separate function: I don't know from the top of my head if this is all legacy code that can be skipped, or if it should be replaced with something. And it needs to be carefully tested indeed, but I don't how all the use cases, there are too many :) So unless you know exactly how to test this in all examples, I would revert this subfunction.

I mean, you wrote the comment that the following part is legacy code that should be removed later on. I think it would be the wrong signal if we just add a small subfunction and we say we can't do this because we don't know how to test this. I checked the IO parameters, they seem to be fine. I can run the unit testing and the test datasets at the AMC. Just thought that you might have something simpler in mind.

@MichaelStritt
Copy link
Contributor

Unit testing

====================================== TEST RESULTS ======================================

                        name                           unit           tests        passed
    ____________________________________________    __________    _____________    ______

    'xASL_adm_CatchNumbersFromString'               'function'    [1x3  struct]    true  
    'xASL_adm_CheckFileCount'                       'function'    [1x2  struct]    true  
    'xASL_adm_CompareLists'                         'function'    [1x2  struct]    true  
    'xASL_adm_CorrectName'                          'function'    [1x3  struct]    true  
    'xASL_adm_DeleteFileList'                       'function'    [1x2  struct]    true  
    'xASL_adm_OrderFields'                          'function'    [1x1  struct]    true  
    'xASL_bids_BIDS2Legacy'                         'function'    [1x2  struct]    true  
    'xASL_bids_CheckDatasetDescription'             'function'    [1x2  struct]    true  
    'xASL_bids_Config'                              'function'    [1x1  struct]    true  
    'xASL_bids_CreateDatasetDescriptionTemplate'    'function'    [1x2  struct]    true  
    'xASL_bids_JsonCheck'                           'function'    [1x3  struct]    true  
    'xASL_bids_VendorFieldCheck'                    'function'    [1x1  struct]    true  
    'xASL_io_ExportVTK'                             'function'    [1x5  struct]    true  
    'xASL_io_Nifti2Im'                              'function'    [1x1  struct]    true  
    'xASL_stat_PSNR'                                'function'    [1x2  struct]    true  
    'xASL_stat_QuantileNan'                         'function'    [1x1  struct]    true  
    'xASL_stat_StdNan'                              'function'    [1x3  struct]    true  
    'xASL_str2num'                                  'function'    [1x3  struct]    true  
    'xASL_test_GetLogContent'                       'function'    [1x2  struct]    true  
    'xASL_tsvRead'                                  'function'    [1x2  struct]    true  
    'xASL_tsvWrite'                                 'function'    [1x2  struct]    true  
    'xASL_ExploreASL_Master'                        'master'      [1x11 struct]    true  
    'xASL_module_ASL'                               'module'      [1x1  struct]    true  
    'xASL_module_Population'                        'module'      [1x1  struct]    true  
    'xASL_module_Structural'                        'module'      [1x1  struct]    true  

==========================================================================================

@MichaelStritt
Copy link
Contributor

10 test datasets

>> ResultsTable

ResultsTable = 

  Columns 1 through 8

    'Data'                   'mean_qCBF_TotalGM'    'median_qCBF_TotalGM'    'median_qCBF_DeepWM'    'CoV_qCBF_TotalGM'    'GMvol'     'WMvol'     'CSFvol'
    'GE_3Dspiral_T1pre…'    '64.51'                '52.2732'                '32.0559'               '0.29926'             [0.6400]    [0.5054]    [0.4330]
    'Philips_2DEPI_FEA…'    '38.9729'              '27.6587'                '6.73'                  '0.71513'             [0.5349]    [0.4590]    [0.4056]
    'Philips_2DEPI_FLA…'    '74.0946'              '56.3948'                '22.9226'               '0.33662'             [0.5442]    [0.3920]    [0.3561]
    'Philips_2DEPI_FLA…'    '48.959'               '43.4651'                '20.3422'               '0.41853'             [0.6994]    [0.5816]    [0.2222]
    'Philips_2DEPI_Les…'    'empty'                '14.4365'                '3.4282'                '0.89241'             [0.7096]    [0.5136]    [0.1942]
    'Philips_2DEPI_Seg…'    '45.9512'              '41.1554'                '9.4098'                '0.36523'             [0.8167]    [0.4596]    [0.1516]
    'Philips_3DGRASE_F…'    '35.1324'              '26.2474'                '7.6225'                '0.66049'             [0.5716]    [0.5282]    [0.4207]
    'Philips_3DGRASE_M…'    '31.9461'              '24.3224'                '8.5892'                '0.43733'             [0.7239]    [0.5520]    [0.3564]
    'Siemens3DGRASE_St…'    '37.6957'              '37.2872'                '21.7901'               '0.78873'             [0.5191]    [0.4658]    [0.4054]
    'Siemens_2DEPI_noB…'    '67.5016'              '50.6498'                '13.4243'               '0.31698'             [0.6886]    [0.6030]    [0.3101]

  Columns 9 through 11

    'PipelineCompleted'    'TC_ASL_Registration'    'TC_M0_Registration'
    [                1]    [             0.8995]    [            0.9315]
    [                1]    [             0.7292]    [            0.8137]
    [                1]    [             0.9194]    [            0.9479]
    [                1]    [             0.8141]    [            0.8344]
    [                1]    [             0.7443]    [            0.8897]
    [                1]    [             0.8544]    [            0.8028]
    [                1]    [             0.8568]    [            0.7545]
    [                1]    [             0.8389]    [            0.8932]
    [                1]    [             0.6915]    [            0.4987]
    [                1]    [             0.8757]    [            0.9589]
>> ResultsComparison.xASL_v1_7_0

ans = 

  Columns 1 through 8

    'Data'                   'mean_qCBF_TotalGM'    'median_qCBF_TotalGM'    'median_qCBF_DeepWM'    'CoV_qCBF_TotalGM'    'GMvol'    'WMvol'    'CSFvol'
    'GE_3Dspiral_T1pre…'    [                1]    [                  1]    [                 1]    [               1]    [    1]    [    1]    [     1]
    'Philips_2DEPI_FEA…'    [                1]    [                  1]    [                 1]    [               1]    [    1]    [    1]    [     1]
    'Philips_2DEPI_FLA…'    [                0]    [                  0]    [                 0]    [               0]    [    1]    [    1]    [     1]
    'Philips_2DEPI_FLA…'    [                1]    [                  1]    [                 0]    [               0]    [    1]    [    1]    [     1]
    'Philips_2DEPI_Les…'    [                1]    [                  0]    [                 0]    [               1]    [    1]    [    1]    [     1]
    'Philips_2DEPI_Seg…'    [                1]    [                  1]    [                 1]    [               1]    [    1]    [    1]    [     1]
    'Philips_3DGRASE_F…'    [                1]    [                  1]    [                 1]    [               0]    [    1]    [    1]    [     1]
    'Philips_3DGRASE_M…'    [                1]    [                  1]    [                 1]    [               0]    [    1]    [    1]    [     1]
    'Siemens3DGRASE_St…'    [                1]    [                  1]    [                 1]    [               1]    [    1]    [    1]    [     1]
    'Siemens_2DEPI_noB…'    [                1]    [                  1]    [                 1]    [               1]    [    1]    [    1]    [     1]

  Columns 9 through 11

    'PipelineCompleted'    'TC_ASL_Registration'    'TC_M0_Registration'
    [                1]    [                  1]    [                 1]
    [                1]    [                  1]    [                 1]
    [                1]    [                  0]    [                 1]
    [                1]    [                  0]    [                 0]
    [                1]    [                  0]    [                 1]
    [                1]    [                  1]    [                 1]
    [                1]    [                  1]    [                 1]
    [                1]    [                  1]    [                 1]
    [                1]    [                  1]    [                 1]
    [                1]    [                  1]    [                 1]

Copy link
Contributor

@MichaelStritt MichaelStritt left a comment

Choose a reason for hiding this comment

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

As can be seen in the unit testing and the 10 test datasets, everything should be fine. The deviations from the correct values in the 10 test datasets are because this branch does not have the up-to-date reference table.

@MichaelStritt MichaelStritt force-pushed the bug-#827_Population_Parallel branch from c57d407 to 5a888b9 Compare September 27, 2021 13:20
@MichaelStritt MichaelStritt merged commit 5a888b9 into develop Sep 27, 2021
@MichaelStritt MichaelStritt deleted the bug-#827_Population_Parallel branch September 27, 2021 13:20
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.

Population module becomes x.Q.Sequence independent

2 participants