For index file, its straight forward and use command lines written below, just replace the .bval filename.
myVar=($(wc -w dwi.bval)) indx="" for ((i=1; i index.txt
For acquisition parameters file, its bit complicated process. The basic requirement is you should know the phase encoding direction which you can get from sequence pdf file or dicominfo also.
If you have .json file, the direction of scan can be determined as one of the following with descending priority:
PhaseEncodingDirectionDisplayed i.e A->P or P->A
PhaseEncodingDirection: right-anterior-superior are the positive directions. So if #2 is j, that means P-->A, if it is j- or -j, then it is A-->P. In the former case, we want 0 1 0, in the latter case we want 0 -1 0 as the first three parameters on a line in --acqp file.
So for A->P it will be [0 -1 0] and P->A [0 1 0].
Fourth parameter can be determined as one of the following way with descending priority:
TotalReadoutTime
(BandwidthPerPixelPhaseEncode or just BandwidthPerPixel) * (PhaseEncodingSteps - 1)
EffectiveEchoSpacing * (PhaseEncodingSteps - 1)
Least preferred according to our observation of various json files: DwellTime * (PhaseEncodingSteps - 1)
So for example, if you scanned your data with A->P direction and Total Readout time is 0.0597 the --acqp file will be: