Skip to content

Commit 920b879

Browse files
committed
Added format utils.
1 parent e40fcb6 commit 920b879

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Cell:
2+
def __init__(self, arg):
3+
self.arg = arg
4+
5+
def to_string(self):
6+
if isinstance(self.arg, list):
7+
v = "\n".join([f"'{el}'" for el in self.arg])
8+
else:
9+
v = self.arg
10+
return v
11+
12+
13+
class NestedCell(Cell):
14+
def __str__(self):
15+
return "{{%s}}" % self.to_string()

nipype/interfaces/cat12/preprocess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
File,
1010
Str,
1111
)
12+
from nipype.interfaces.cat12.format_utils import Cell
13+
1214
from nipype.interfaces.spm import SPMCommand
1315
from nipype.interfaces.spm.base import (
1416
SPMCommandInputSpec,
@@ -18,8 +20,6 @@
1820
)
1921
from nipype.utils.filemanip import split_filename, fname_presuffix
2022

21-
from src.interfaces.cat12.surface import Cell
22-
2323

2424
class CAT12SegmentInputSpec(SPMCommandInputSpec):
2525
in_files = InputMultiPath(

nipype/interfaces/cat12/surface.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pathlib import Path
33

44
from nipype.interfaces.base import File, InputMultiPath, TraitedSpec, traits, isdefined
5+
from nipype.interfaces.cat12.format_utils import NestedCell, Cell
56
from nipype.interfaces.spm import SPMCommand
67
from nipype.interfaces.spm.base import SPMCommandInputSpec
78
from nipype.utils.filemanip import split_filename
@@ -269,23 +270,6 @@ def _list_outputs(self):
269270
return outputs
270271

271272

272-
class Cell:
273-
def __init__(self, arg):
274-
self.arg = arg
275-
276-
def to_string(self):
277-
if isinstance(self.arg, list):
278-
v = "\n".join([f"'{el}'" for el in self.arg])
279-
else:
280-
v = self.arg
281-
return v
282-
283-
284-
class NestedCell(Cell):
285-
def __str__(self):
286-
return "{{%s}}" % self.to_string()
287-
288-
289273
class Cell2Str(Cell):
290274
def __str__(self):
291275
"""Convert input to appropriate format for cat12"""

0 commit comments

Comments
 (0)