Internal API Reference

These functions are not exported but may be useful for advanced usage or are documented here for contributor reference.

MDH Parsing

MRITwixTools.readMDH! — Function
readMDH!(s::RawData, mdh::MDH, filePos, useScan)

Extract MDH values for the selected scans and populate the RawData.

MRITwixTools.calcIndices — Function
calcIndices(s::RawData) -> (ixToRaw, ixToTarget)

Calculate mapping from MDH acquisitions to target array positions.

MRITwixTools.calcRange — Function
calcRange(s::RawData, S) -> (selRange, selRangeSz, outSize)

Calculate selection ranges for data retrieval.

MRITwixTools.readData — Function
readData(s, mem; cIxToTarg, cIxToRaw, selRange, selRangeSz, outSize)

Read raw data from file. Core I/O routine.

Data Helpers

MRITwixTools.fixLoopCounter! — Function
fixLoopCounter!(s, loop, newLoop)

Replace a loop counter with new values. Note: because AcquisitionMeta is immutable, this rebuilds the entire meta struct.

MRITwixTools.average_dim — Function
average_dim(s::RawData) -> Vector{Bool}

Return a length-16 boolean vector indicating which dimensions are averaged.

MRITwixTools.loop_counter — Function
loop_counter(meta::AcquisitionMeta, dim_index::Int) -> Vector{Int32}

Get the loop counter vector for a given dimension index (DIMLIN..DIMIDE).

MRITwixTools.dim_extent — Function
dim_extent(dims::DimSizes, i::Int) -> Int

Get the extent for dimension i (1-based, matching DIM_* constants).

Header Parsing

MRITwixTools.parse_ascconv — Function
parse_ascconv(buffer::AbstractString) -> NestedDict

Parse ASCCONV section from Siemens header buffer into a tree structure. E.g., sKSpace.lBaseResolution = 256 becomes accessible as result.sKSpace.lBaseResolution.

MRITwixTools.parse_xprot — Function
parse_xprot(buffer::AbstractString) -> Dict

Parse XProtocol section from Siemens header buffer.

MRITwixTools.parse_buffer — Function
parse_buffer(buffer::AbstractString) -> NestedDict

Parse a complete header buffer (both ASCCONV and XProtocol sections) into a single NestedDict tree.

Utilities

MRITwixTools.cumtrapz — Function
cumtrapz(y)

Cumulative trapezoidal integration (like scipy.integrate.cumulative_trapezoid). Returns a vector of length(y) with 0 prepended.