Skip to content

Commit 7e0dc93

Browse files
authored
Merge pull request #818 from AllenNeuralDynamics/feat-787-MRI-updates
making MriScan.voxel_sizes optional
2 parents 4318619 + 21cc8f8 commit 7e0dc93

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/aind_data_schema/core/mri_session.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class MRIScan(AindModel):
5656
vc_position: Optional[Translation3dTransform] = Field(None, title="Scan position")
5757
subject_position: SubjectPosition = Field(..., title="Subject position")
5858
# other fields
59-
voxel_sizes: Scale3dTransform = Field(..., title="Voxel sizes", description="Resolution")
59+
voxel_sizes: Optional[Scale3dTransform] = Field(None, title="Voxel sizes", description="Resolution")
6060
processing_steps: List[
6161
Literal[
6262
ProcessName.FIDUCIAL_SEGMENTATION,
@@ -83,8 +83,8 @@ def validate_primary_scan(self):
8383
"""Validate that primary scan has vc_orientation and vc_position fields"""
8484

8585
if self.primary_scan:
86-
if not self.vc_orientation or not self.vc_position:
87-
raise ValueError("Primary scan must have vc_orientation and vc_position")
86+
if not self.vc_orientation or not self.vc_position or not self.voxel_sizes:
87+
raise ValueError("Primary scan must have vc_orientation, vc_position, and voxel_sizes fields")
8888

8989

9090
class MriSession(AindCoreModel):

tests/test_imaging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ def test_validators(self):
335335

336336
expected_exception = (
337337
"1 validation error for MRIScan\n"
338-
" Value error, Primary scan must have vc_orientation and vc_position [type=value_error, "
339-
"input_value={'scan_index': 1, 'scan_t... {'number_averages': 3}}, input_type=dict]\n"
338+
" Value error, Primary scan must have vc_orientation, vc_position, and voxel_sizes fields "
339+
"[type=value_error, input_value={'scan_index': 1, 'scan_t... {'number_averages': 3}}, input_type=dict]\n"
340340
f" For further information visit https://errors.pydantic.dev/{PYD_VERSION}/v/value_error"
341341
)
342342
self.assertEqual(expected_exception, repr(e.exception))

0 commit comments

Comments
 (0)