ENH: Read NIfTI File should apply flipped axes from the stored transform

オープン
#1,926 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 6 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp
領域
data

調査の方向性

Start with ReadNiftiHeader and the voxel read in src/Plugins/ImageProcessing/src/ImageProcessing/utils/NiftiUtilities.cpp, then trace preflight and warning -34750 in ReadNIfTIFileFilter and review ReadNIfTIFileFilter.md. Check both the regular and out-of-core paths. The issue leaves the flip option, origin convention, and warning behavior undecided; those decisions must be settled before implementation, and done means flipped voxel order and geometry preserve the file's physical placement.

索引モデルが issue の本文から書いたものです。

説明

enhancement

Summary

Request. With Use Stored Affine Transform on, Read NIfTI File (ReadNIfTIFileFilter) should apply an axis flip that the file stores. When the file gives a negative direction for an axis, the filter should reverse the voxel order along that axis and move the origin, so that the Image Geometry has the same physical placement and orientation as the file. Today the filter only warns about the flip.

Why it is needed. Many NIfTI files store a negative direction for one or more axes. The common LPS/RAS radiological conventions use a negative X or Y direction. The reader always uses positive spacing and loads the voxels in their stored order, so such an image is placed mirrored along that axis. A user who combines it with other data in physical coordinates, for example a mask or a second scan, gets data that does not line up. The warning tells the user about this, but the user must then flip the data with another filter and correct the origin by hand.

How it works now.

  • ReadNiftiHeader takes the spacing from the length of each sform column (always positive) and the origin from the translation column. For the qform, it uses the offsets as the origin and only checks the quaternion for a rotation. The sign of each axis is dropped.
  • PR #1911 (#1908 item L59) adds a flag for a flipped axis: a negative diagonal term in a used sform, qfac = -1 (pixdim[0] < 0) in a used qform, or a negative pixdim[1..3] when no sform is used. Preflight then gives warning -34750 ("contains negative direction values ... does not preserve these directions"). The geometry and the voxel order do not change.
  • A rotation in the transform is dropped too, with its own warning -34750 (ReadNIfTIFileFilter.cpp:279). Rotations are not part of this request.

Where it applies.

  • src/Plugins/ImageProcessing/src/ImageProcessing/utils/NiftiUtilities.cpp (ReadNiftiHeader and the voxel read).
  • ReadNIfTIFileFilter (preflight geometry values and warning -34750) and its documentation page ReadNIfTIFileFilter.md.
  • The out-of-core read path, because the voxel order along a flipped axis changes.

Open design points. Whether the flip is always applied or is a new option (and its default), which origin the flipped geometry gets (the physical position of the first voxel or of the voxel corner), and whether warning -34750 stays for the flip case are not decided yet.

主要言語
C++
スター
18
フォーク
15
平均マージ
4日 23時間
マージ済み PR(30日)
42

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

BlueQuartzSoftware/simplnx のほかの issue

BlueQuartzSoftware/simplnx の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。