Skip to content

Commit 474c85b

Browse files
oestebanmgxd
andcommittedOct 28, 2019
Apply suggestions from code review
Co-Authored-By: Mathias Goncalves <[email protected]>
1 parent d9e74f7 commit 474c85b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed
 

‎nitransforms/io/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Read/write linear transforms."""
22
from scipy.io.matlab.miobase import get_matfile_version
3-
from scipy.io.matlab.mio4 import MatFile4Reader # , MatFile4Writer
4-
from scipy.io.matlab.mio5 import MatFile5Reader # , MatFile5Writer
3+
from scipy.io.matlab.mio4 import MatFile4Reader
4+
from scipy.io.matlab.mio5 import MatFile5Reader
55

66
from ..patched import LabeledWrapStruct
77

‎nitransforms/io/itk.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def to_filename(self, filename):
6363
f.write(self.to_string())
6464

6565
def to_ras(self):
66-
"""Return a nitransforms' internal RAS matrix."""
66+
"""Return a nitransforms internal RAS+ matrix."""
6767
sa = self.structarr
6868
matrix = sa['parameters']
6969
offset = sa['offset']
@@ -165,10 +165,10 @@ def xforms(self):
165165

166166
@xforms.setter
167167
def xforms(self, value):
168-
self._xforms = value
168+
self._xforms = list(value)
169169

170170
# Update indexes
171-
for i, val in enumerate(self._xforms):
171+
for i, val in enumerate(self.xforms):
172172
val['index'] = i
173173

174174
def __getitem__(self, idx):
@@ -182,14 +182,14 @@ def __getitem__(self, idx):
182182
def to_filename(self, filename):
183183
"""Store this transform to a file with the appropriate format."""
184184
if str(filename).endswith('.mat'):
185-
raise TransformFileError('Please use the ITK\'s new .h5 format.')
185+
raise TransformFileError("Please use the ITK's new .h5 format.")
186186

187187
with open(str(filename), 'w') as f:
188188
f.write(self.to_string())
189189

190190
def to_ras(self):
191191
"""Return a nitransforms' internal RAS matrix."""
192-
return np.stack([xfm.to_ras() for xfm in self._xforms])
192+
return np.stack([xfm.to_ras() for xfm in self.xforms])
193193

194194
def to_string(self):
195195
"""Convert to a string directly writeable to file."""
@@ -202,7 +202,7 @@ def to_string(self):
202202
@classmethod
203203
def from_binary(cls, byte_stream):
204204
"""Read the struct from a matlab binary file."""
205-
raise TransformFileError('Please use the ITK\'s new .h5 format.')
205+
raise TransformFileError("Please use the ITK's new .h5 format.")
206206

207207
@classmethod
208208
def from_fileobj(cls, fileobj, check=True):

0 commit comments

Comments
 (0)
Please sign in to comment.