AI Infrastructure
A NIfTI Image Can Declare Two Useful Coordinate Mappings
NIfTI-1 can give one voxel two useful coordinate descriptions: for example, scanner-anatomical coordinates through qform and standard-space coordinates through sform. Select the declared mapping required by the intended comparison and confirm that the receiving application uses it. Different numbers in different named spaces do not, by themselves, establish an alignment error.
Choose the coordinate space the comparison needs
A neuroimaging input comparison may need a selected voxel's location in acquisition coordinates, or its declared relationship to a standard reference. Those requests can lead to different coordinates while starting from the same stored volume.
The NIfTI-1 FAQ explains the purpose of retaining both forms: acquisition geometry and a relationship to standard space can accompany the original samples without requiring their resampling. The format's rationale likewise describes software using either mapping according to its purpose.
The useful first question is therefore which spatial reference the receiving task requires. Comparing the two matrices before answering that question can mistake useful coexistence for a defect. Conversely, accepting whichever coordinates a reader happens to return can answer the wrong question. The delivery and application owners need to agree on the interpretation.
Read the index, unit and space declaration together
In the three-dimensional NIfTI-1 description, (i,j,k) denotes zero-based array indices. The spatial result (x,y,z) locates the voxel center. Dimensions count positions; the spatial part of xyzt_units declares the physical unit for coordinate distances. An index such as (4,3,2) is not already a location in millimeters.
A positive qform_code or sform_code identifies a specified mapping through that form. Code 1, NIFTI_XFORM_SCANNER_ANAT, declares scanner-based anatomical coordinates; code 4, NIFTI_XFORM_MNI_152, declares MNI152 normalized coordinates. A zero code does not supply an identified orientation through that form; if both codes are zero, voxel sizes alone do not establish it.
Read the actual code rather than inferring the space solely from the field name. The header documentation also allows qform to describe aligned coordinates. Neither a positive code nor the word sform supplies a universal rule for every receiving application's choice.
NI-43: two coordinate results from one unchanged array
Stipulate a synthetic 8 x 8 x 8 array whose 512 sample values remain unchanged. The selected index is (i,j,k) = (4,3,2), and the declared spatial unit is millimeters. NI-43 is a constructed example of selected mapping fields and arithmetic; no header, medical dataset, registration or reader test was produced.
The qform declaration has code 1, identity rotation, qfac = +1, pixdim[1..3] = (2,2,2), and offsets (10,20,30) mm. Its equations are x = 2i + 10, y = 2j + 20 and z = 2k + 30. At the selected index, these give (8+10,6+20,4+30) = (18,26,34) mm in the declared scanner-anatomical space.
The sform declaration has code 4 and rows srow_x = (2,0.5,0,-4), srow_y = (0,2,0,5) and srow_z = (0,0,2,6). Its equations are x = 2i + 0.5j - 4, y = 2j + 5 and z = 2k + 6. Substitution gives (8+1.5-4,6+5,4+6) = (5.5,11,10) mm in the declared MNI152 space.
Each form starts from the same selected index. Applying the sform to the qform's spatial result would instead treat spatial coordinates as voxel indices and compute a different, unintended quantity.
The two results inhabit different named spaces. Their numerical difference is not automatically a displacement or a vector measuring alignment error in a common frame.
References: [NF1]
Why this sform cannot be represented by the qform parameters
qform combines a quaternion-derived proper rotation, the three pixdim scales, qfac and translation. qfac supplies a sign on the third scaled index axis. sform instead applies its general affine rows directly to the indices, without an additional multiplication by pixdim.
The difference is visible in NI-43. Increasing i by one has sform displacement (2,0,0) mm; increasing j by one has displacement (0.5,2,0) mm. Their dot product is 2 x 0.5 + 0 x 2 + 0 x 0 = 1 square millimeter, rather than zero. The two mapped index directions are not perpendicular.
A rotation with independent axis scales, including the qfac sign, keeps those directions perpendicular. It therefore cannot reproduce this particular sform's shear. An off-diagonal coefficient alone would not prove that conclusion, because ordinary rotations can also have off-diagonal coefficients; the nonzero dot product supplies the distinction here.
Making these two forms numerically equal would change at least one of the stipulated coordinate descriptions. Agreement between the matrices is not the objective of this example. Preserving the interpretation required by the consumer is.
Compare the coordinates a delivery offer promises
Consider two hypothetical offers for the unchanged NI-43 array. A scanner-coordinate return identifies qform and reports (18,26,34) mm for the selected voxel. A declared MNI152-coordinate return identifies sform and reports (5.5,11,10) mm. Each answers its own stated request. Calling both outputs world coordinates would conceal the distinction the buyer needs.
For the standard-space request, the delivered values must remain associated with their index-axis meanings and the applicable full affine mapping, unit and space declaration. The reference template or space definition and supporting registration provenance must be identifiable to the responsible scientific reviewer. A code 4 label alone cannot provide that evidence.
The receiving application and version also matter. Ask its owner to identify which form the actual input path uses and how that selection is established. An offer that retains both forms can satisfy the request if the intended consumer interprets the required one. An offer that silently returns the qform result while labeling it MNI152 has not satisfied that request, even though every array value arrived.
A derived array may have been cropped, reordered or resampled. The offered mapping must describe that delivered grid, with an explained relationship to the source. Keeping an original header beside changed array indices does not demonstrate that relationship.
Finally, distinguish coordinates in a standard space from samples on a particular standard grid. NIfTI's dual-form design can preserve the original array while declaring its standard-space mapping. If the consumer instead needs an array on a specified reference grid, its grid and sampling requirements are an additional part of the proposed delivery. Neither code 4 nor the coordinate calculation supplies that output.
Useful coexistence still has consistency requirements
Different named spaces explain NI-43's two results. They do not excuse every disagreement. If two supplied forms purport to describe the same intended reference but give unexplained different locations, the data and application owners still need to resolve the discrepancy against that reference and the delivery's stated comparison criteria.
The NIfTI-1 FAQ also requires consistency in handedness when both forms are set. The recommended usage page expresses this as avoiding determinants with different signs. NI-43's two linear mappings each have determinant +8, so the example has no such sign conflict. Matching signs addresses this consistency question; it does not require matching coefficients or coordinate values.
For adjacent questions, use the related DICOM geometry article to examine a pixel index's patient-coordinate mapping. Use the OME-TIFF plane article to identify which stored plane represents a requested Z, time and channel combination. Those questions remain distinct from selecting between two spatial mappings of the same NIfTI voxel.
Scope the computing equipment's physical installation separately
If the computing equipment used for neuroimaging needs physical installation, Leviathan's existing Rack-and-Stack Installation service provides a route to discuss agreed equipment mounting, IT cabling, labels and installation records. Share a nonconfidential equipment, rack, site and connection outline through the related project inquiry to discuss scope and availability.
NIfTI interpretation, registration review and application integration remain with the appointed scientific and software providers. The physical installation inquiry concerns the equipment package.
References: [L1]
Primary sources
- [NF1] NIH NIfTI-1 header documentation: qform and sformChecked 2026-10-20. Methods 2 and 3 define voxel-center mappings, qform parameters, direct srow equations and transform codes. Page last modified November 14, 2018; applied here to NIfTI-1.
- [NF2] NIH NIfTI-1 FAQ: alignment information and two coordinate systemsChecked 2026-10-20. Questions 17 and 19 explain coordinate declarations, retaining original samples alongside standard-space mapping, and handedness consistency. The detailed header equations supply the qform scale and qfac interpretation.
- [NF3] NIH NIfTI-1 fields: dimensionality and unitsChecked 2026-10-20. Defines dimension lengths, pixdim widths and the spatial-unit portion of xyzt_units. NI-43 explicitly stipulates millimeters.
- [NF4] Robert W. Cox, NIH: NIfTI-1 Data Format, Rationale and DiscussionChecked 2026-10-20. Historical design rationale dated February 26, 2004. The coordinate-systems discussion explains common-reference comparisons and the purpose of two mappings; no contemporary reader behavior is inferred.
- [NF5] NIH NIfTI-1: Recommended usage of qform and sformChecked 2026-10-20. Historical advisory, last modified May 17, 2005 and marked under construction. Used only for its determinant-sign consistency explanation, corroborated by FAQ question 19.
- [L1] Leviathan Systems: Rack-and-Stack InstallationChecked 2026-10-20. Describes agreed physical equipment mounting, IT cabling, labels and installation records, subject to the released project package and site authorization.