Skip to content

prf Synthesize: how to edit json file

Garikoitz Lerma-Usabiaga edited this page Mar 27, 2020 · 12 revisions

It is important to maintain the json structure after the edits, otherwise the analysis will fail. In this page we will add notes after // to the defaul json file explaining how a real file would be edited.

IMPORTANT: the json file cannot have comments, if any // mark is added to the file, it will fail. Edit always the default config file downloaded from the Docker file, this is the only way of being sure that the latest version is being used.

Grid Configuration The container is designed to create a grid of all combinations of the configuration parameters. For example, if the configuration file includes two center locations for x and y, say 0 and 5, the container generates 4 synthetic BOLD series with centers at [0,0], [0,5], [5,0] and [5,0]. If two HRF-s are specified in the configuration file, say ‘popeye_twogammas’ and ‘afni_spm’, the number of synthetic BOLD time series doubles to 8; the four center locations times two HRFs. If we the configuration parameter ‘repeats’ is set to 100, 100 noisy samples are generated for every parameter combination.

This is the default json file coming from the Docker container, with notes:

[ 
   { 
 "subjectName":"testSubject",
 "sessionName":"editDefaultSessionName",
 "repeats":2,
 "useparallel":true,
 "TR":1,
 "Type":"linear",
 "cssexp":0.05,
 "signalPercentage":"bold",
 "BOLDcontrast":5,
 "BOLDmeanValue":10000,
 "computeSubclasses":true,
 "HRF":[
      "subjectName":"editDefaultSubjectName",  // required, subject name. It will go after _sub- in the filename.
      "sessionName":"editDefaultSessionName",  // required, session name. It will go after _sess- in the filename.
      "repeats":2,                             // Time of repetitions desired for the whole grid. Each repetition will respect the randomized noise parts, i.e. if a noise value and 'random' is selected, each repetition will be different.
      "useparallel":true,                      // Use Matlab's Parallel Toolbox to generate the BOLD time series.
      "TR":1,                                  // TR value. Technically it can create a grid of TR values as well, but the nifti only accepts one TR so here there should be only one value.
      "Type":"basic",                          // Only "basic" available for now. 
      "signalPercentage":"bold",               // Three options: ("bold") BOLD signal, with a mean and a contrast, ("spc") signal percent change, with contrast but zero mean, ("none") Unitless, with the values coming directly from the HRF convolution
      "BOLDcontrast":5,                        // Contrast in %
      "scaleContrast":false,                   // If true, scales the "bold" or "spc" BOLDcontrast value to the maximum possible value for the stimuli and the RF size. 
      "BOLDmeanValue":10000,                   // Mean value of the signal, only applies to the "bold" case
      "computeSubclasses":true,                // Leave default value always, TODO: for now, remove this option
      "HRF":[                                  // HRF section, it can have several HRFs inside, separated by commas. The different HRFs will generate the grid. Each HRF can only have one set of params or none (to use defaults)
         { 
            "Type":"friston",                  // One example HRF with all possible parameters
            "Duration":20,
            "normalize":"none",
            "params":{ 
               "a":[ 
                  6,
                  12
               ],
               "b":[ 
                  0.9,
                  0.9
               ],
               "c":0.35,
               "n":3,
               "tau":1.08,
               "delay":2.05,
               "stimDuration":1
            }
         },
         {"Type":"vista_twogammas"}              // Second example HRF, it will use defaults
      ],
      "RF":[                                     // RF section. There can only be one, but the numbers can be vectors, that will generate the grid of options. 
         { 
            "Centerx0":0,                        // Degrees. Location. It can be a vector of the form [-3,0,3] to generate the grid.
            "Centery0":0,                        // Degrees. Location. It can be a vector of the form [-3,0,3]
            "Theta":0,                           // Radians. Angle respect horizontal of sigmaMajor. It can be a vector of the form [1,2,3]
            "sigmaMajor":1,                      // Degrees. Diameter of gaussian. It can be a vector of the form [1,2,3]
            "sigmaMinor":1,                      // Same as sigmaMajor. Additionally, it can be "same", so that it is always the same value as sigmaMajor, in this case it does contribute to the creation of the grid.
            "dog_sigmaMajor":2,                  // Same as sigmaMajor, but for the Difference of Gaussians model
            "dog_sigmaMinor":2,                  // Same as sigmaMajor, but for the Difference of Gaussians model
            "dog_Theta":0,                       // Same as Theta, but for the Difference of Gaussians model
            "dog_Scale":0.5,                     // Scale factor between the two DoG gaussians
            "Type":"mrvista"                     // Use the analyzePRF or mrVista RF implementations. 
         }
      ],
      "Stimulus":[                               // Stimulus section. There can only be one, and the parameters are not gridable, only one parameters can be chosen.
         { 
            "fieldofviewHorz":20,
            "fieldofviewVert":20,
            "expName":"103",
            "Binary":true,
            "Resize":true,
            "ResizedHorz":101,
            "ResizedVert":101,
            "barWidth":2,
            "durationSecs":200,
            "frameduration":4
         }
      ],
      "Noise":[                                    // Several noise models can be selected. This functions analogous to the HRF, every noise model will add to the grid. The parameters inside each noise model need to be unique. In this example, three noise models where added. 
         { 
            "voxel":"mid",                        // Set of defaults that imitate a real voxel "low", "mid" and "high" noise. It can select "mid" here but then change any of the defaults individually. All defaults are shown in this example.
            "seed":"random",                     // "none" for noiseless, "random" or an integer as a seed
            "jitter":[0,0],                      // [amplitude,frequency] jitter, values from 0-1
            "white_amplitude":0.032,             // White noise amplitude, in signal percent change units
            "cardiac_amplitude":0.01,            // Cardiac noise amplitude, in signal percent change units
            "cardiac_frequency":1.05,            
            "respiratory_amplitude":0.01,        // Respiratory noise amplitude, in signal percent change units
            "respiratory_frequency":0.3,
            "lowfrequ_amplitude":0.01,           // Low-frequency noise amplitude, in signal percent change units
            "lowfrequ_frequ":120
         },
         { 
            "seed":"none",                        // It will generate one grid (times "repeats") voxels with no noise.
         },
         { 
            "voxel":"high",                        // It will generate one grid (times "repeats") voxels with "high" noise defaults.
         }

      ]
   }
]