Skip to content

JSON handling changes#1738

Merged
Lestropie merged 2 commits intodevfrom
json_handling
Oct 3, 2019
Merged

JSON handling changes#1738
Lestropie merged 2 commits intodevfrom
json_handling

Conversation

@Lestropie
Copy link
Copy Markdown
Member

@Lestropie Lestropie commented Sep 25, 2019

Well that was tremendous fun. Details in 2d279b2. Related to attempting to resolve bids-apps/MRtrix3_connectome#59 via #1735.

master:

{
    "EchoTime": "0.028",
    "FlipAngle": "90",
    "MultibandAccelerationFactor": "1",
    "PhaseEncodingDirection": "j-",
    "RepetitionTime": "3.93",
    "SliceEncodingDirection": "k",
    "SliceTiming": [
        [
            1.96500003,
            0.0,
            2.03250003,
            0.0675000027,
            2.09750009,
            0.132499993,
            2.1624999,
            0.197500005,
            2.22749996,
            0.262499988,
            2.29250002,
            0.327499986,
            2.3599999,
            0.395000011,
            2.42499995,
            0.460000008,
            2.49000001,
            0.524999976,
            2.55500007,
            0.589999974,
            2.61999989,
            0.654999971,
            2.68499994,
            0.722500026,
            2.75250006,
            0.787500024,
            2.81750011,
            0.852500021,
            2.88249993,
            0.917500019,
            2.94749999,
            0.982500017,
            3.01250005,
            1.04999995,
            3.07999992,
            1.11500001,
            3.14499998,
            1.17999995,
            3.21000004,
            1.245,
            3.2750001,
            1.30999994,
            3.33999991,
            1.37750006,
            3.40750003,
            1.4425,
            3.47250009,
            1.50750005,
            3.5374999,
            1.57249999,
            3.60249996,
            1.63750005,
            3.66750002,
            1.70500004,
            3.7349999,
            1.76999998,
            3.79999995,
            1.83500004,
            3.86500001,
            1.89999998
        ]
    ],
    "TotalReadoutTime": "0.0447",
    "comments": "ORIENTATION TEST (2016_10_05) [MR] ep2d_se AXIAL A-P\nstudy: BRI_PROTOCOLS VE11A Post 08-03-2016 SB.2002.060RS EPI - ROB - 20 [ ORIGINAL PRIMARY M ND NORM ]\nDOB: 01/01/1975\nDOS: 06/10/2016 14:09:38"
}

This branch:

{
    "EchoTime": 0.028,
    "FlipAngle": 90,
    "MultibandAccelerationFactor": 1,
    "PhaseEncodingDirection": "j-",
    "RepetitionTime": 3.93,
    "SliceEncodingDirection": "k",
    "SliceTiming": [
        1.96500003,
        0.0,
        2.03250003,
        0.0675000027,
        2.09750009,
        0.132499993,
        2.1624999,
        0.197500005,
        2.22749996,
        0.262499988,
        2.29250002,
        0.327499986,
        2.3599999,
        0.395000011,
        2.42499995,
        0.460000008,
        2.49000001,
        0.524999976,
        2.55500007,
        0.589999974,
        2.61999989,
        0.654999971,
        2.68499994,
        0.722500026,
        2.75250006,
        0.787500024,
        2.81750011,
        0.852500021,
        2.88249993,
        0.917500019,
        2.94749999,
        0.982500017,
        3.01250005,
        1.04999995,
        3.07999992,
        1.11500001,
        3.14499998,
        1.17999995,
        3.21000004,
        1.245,
        3.2750001,
        1.30999994,
        3.33999991,
        1.37750006,
        3.40750003,
        1.4425,
        3.47250009,
        1.50750005,
        3.5374999,
        1.57249999,
        3.60249996,
        1.63750005,
        3.66750002,
        1.70500004,
        3.7349999,
        1.76999998,
        3.79999995,
        1.83500004,
        3.86500001,
        1.89999998
    ],
    "TotalReadoutTime": 0.0447,
    "comments": [
        "ORIENTATION TEST (2016_10_05) [MR] ep2d_se AXIAL A-P",
        "study: BRI_PROTOCOLS VE11A Post 08-03-2016 SB.2002.060RS EPI - ROB - 20 [ ORIGINAL PRIMARY M ND NORM ]",
        "DOB: 01/01/1975",
        "DOS: 06/10/2016 14:09:38"
    ]
}

Note in master:

  • Quotation marks around numerical values;

  • Erroneous double-nesting of SliceTiming (which dwipreproc is currently assuming is present, hence Fixes to slice timing handling #1735 being to master);

  • comments being a single string containing newline characters, rather than an array of strings.

Needs to go to dev since it's behaviour-changing.

- Move some JSON handling out of cmd/mrinfo.cpp and into core/file/json_utils.* so that improvements are utilised consistently across "mrinfo -json_*" and "mrconvert -json_export".
- For new functions in File::JSON, provide function argument to toggle reorientation of header keys that are dependent on image axis orientations, so that such data can be reoriented when loading / saving data alongside NIfTI images but not when wanting to see the data "as interpreted by MRtrix3".
- mrinfo: Preclude use of -json_all if multiple input images are specified.
- Improve formatting of output JSON files, by inferring the format of key-value data stored as plain text in image headers and honouring those formats when writing to the JSON object.
@Lestropie Lestropie self-assigned this Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant