-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Select ISMRMRD acquisitions with a function instead of ignore flags (#…
…315)
- Loading branch information
Showing
6 changed files
with
169 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
"""Test ISMRMRD acquisitions based on their flags.""" | ||
|
||
# Copyright 2024 Physikalisch-Technische Bundesanstalt | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at: | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import ismrmrd | ||
|
||
from mrpro.data.enums import AcqFlags | ||
|
||
# Same criteria as https://github.com/wtclarke/pymapvbvd/blob/master/mapvbvd/mapVBVD.py uses | ||
DEFAULT_IGNORE_FLAGS = ( | ||
AcqFlags.ACQ_IS_NOISE_MEASUREMENT | ||
| AcqFlags.ACQ_IS_DUMMYSCAN_DATA | ||
| AcqFlags.ACQ_IS_HPFEEDBACK_DATA | ||
| AcqFlags.ACQ_IS_NAVIGATION_DATA | ||
| AcqFlags.ACQ_IS_PHASECORR_DATA | ||
| AcqFlags.ACQ_IS_PHASE_STABILIZATION | ||
| AcqFlags.ACQ_IS_PHASE_STABILIZATION_REFERENCE | ||
| AcqFlags.ACQ_IS_PARALLEL_CALIBRATION | ||
) | ||
|
||
|
||
def is_image_acquisition(acquisition: ismrmrd.Acquisition) -> bool: | ||
"""Test if acquisition was obtained for imaging. | ||
Parameters | ||
---------- | ||
acquisition | ||
ISMRMRD acquisition | ||
Returns | ||
------- | ||
True if the acquisition was obtained for imaging | ||
""" | ||
return not DEFAULT_IGNORE_FLAGS.value & acquisition.flags | ||
|
||
|
||
def is_noise_acquisition(acquisition: ismrmrd.Acquisition) -> bool: | ||
"""Test if acquisition contains noise measurements. | ||
Parameters | ||
---------- | ||
acquisition | ||
ISMRMRD acquisition | ||
Returns | ||
------- | ||
True if the acquisition contains a noise measurement | ||
""" | ||
return AcqFlags.ACQ_IS_NOISE_MEASUREMENT.value & acquisition.flags | ||
|
||
|
||
def is_coil_calibration_acquisition(acquisition: ismrmrd.Acquisition) -> bool: | ||
"""Test if acquisitions was obtained for coil calibration. | ||
Parameters | ||
---------- | ||
acquisition | ||
ISMRMRD acquisition | ||
Returns | ||
------- | ||
True if the acquisition contains coil calibration data | ||
""" | ||
coil_calibration_flag = AcqFlags.ACQ_IS_PARALLEL_CALIBRATION | AcqFlags.ACQ_IS_PARALLEL_CALIBRATION_AND_IMAGING | ||
return coil_calibration_flag.value & acquisition.flags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters