File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -275,9 +275,15 @@ def forward(self, x: MetaTensor) -> MetaTensor:
275275 if isinstance (x , MetaTensor ):
276276 if "pixdim" in x .meta :
277277 if x .meta ["pixdim" ].ndim == 1 :
278- properties_or_list_of_properties = {"spacing" : x .meta ["pixdim" ][1 :4 ].tolist ()}
278+ if x .meta ["pixdim" ][0 ] == 1 :
279+ properties_or_list_of_properties = {"spacing" : x .meta ["pixdim" ][1 :4 ].tolist ()}
280+ else :
281+ properties_or_list_of_properties = {"spacing" : x .meta ["pixdim" ][:3 ].tolist ()}
279282 else :
280- properties_or_list_of_properties = {"spacing" : x .meta ["pixdim" ][0 ][1 :4 ].numpy ().tolist ()}
283+ if x .meta ["pixdim" ][0 ][0 ] == 1 :
284+ properties_or_list_of_properties = {"spacing" : x .meta ["pixdim" ][0 ][1 :4 ].numpy ().tolist ()}
285+ else :
286+ properties_or_list_of_properties = {"spacing" : x .meta ["pixdim" ][0 ][:3 ].numpy ().tolist ()}
281287 elif "affine" in x .meta :
282288 spacing = [
283289 abs (x .meta ["affine" ][0 ][0 ].item ()),
You can’t perform that action at this time.
0 commit comments