5
5
6
6
from nibabel import load , save , Nifti1Image
7
7
8
- import discrete_domain as ddom
8
+ from . import discrete_domain as ddom
9
9
10
10
##############################################################################
11
11
# class MultiROI
@@ -19,7 +19,8 @@ class MultiROI(object):
19
19
"""
20
20
21
21
def __init__ (self , domain , k , rid = '' ):
22
- """
22
+ """ Initialize multi ROI instance
23
+
23
24
Parameters
24
25
----------
25
26
domain: ROI instance
@@ -75,7 +76,8 @@ class SubDomains(object):
75
76
"""
76
77
77
78
def __init__ (self , domain , label , id = '' , no_empty_label = True ):
78
- """
79
+ """ Initialize subdomains instance
80
+
79
81
Parameters
80
82
----------
81
83
domain: ROI instance
@@ -209,16 +211,16 @@ def select(self, valid, id='', auto=True, no_empty_label=True):
209
211
return SD
210
212
211
213
def make_feature (self , fid , data , override = True ):
212
- """Extract a set of ffeatures from a domain map
214
+ """Extract a set of features from a domain map
213
215
214
216
Parameters
215
217
----------
216
- fid: string,
217
- feature identifier
218
+ fid: string
219
+ feature identifier
218
220
data: array of shape(deomain.size) or (domain, size, dim),
219
- domain map from which ROI features are axtracted
221
+ domain map from which ROI features are axtracted
220
222
override: bool, optional,
221
- Allow feature overriding
223
+ Allow feature overriding
222
224
"""
223
225
if data .shape [0 ] != self .domain .size :
224
226
raise ValueError ("Incorrect data provided" )
@@ -333,7 +335,7 @@ def plot_feature(self, fid, ax=None):
333
335
334
336
Parameters
335
337
----------
336
- fid: string,
338
+ fid: string
337
339
the feature identifier
338
340
ax: axis handle, optional
339
341
"""
@@ -349,11 +351,14 @@ def plot_feature(self, fid, ax=None):
349
351
return ax
350
352
351
353
def set_roi_feature (self , fid , data ):
352
- """
354
+ """ Set feature defined by `fid` and `data` into ``self``
355
+
353
356
Parameters
354
357
----------
355
- fid: string, feature identifier
356
- data: array of shape(self.k, p), with p>0
358
+ fid: string
359
+ feature identifier
360
+ data: array
361
+ shape(self.k, p), with p>0
357
362
"""
358
363
if data .shape [0 ] != self .k :
359
364
print data .shape [0 ], self .k , fid
@@ -368,15 +373,15 @@ def get_roi_feature(self, fid):
368
373
return self .roi_features [fid ]
369
374
370
375
def to_image (self , path = None , descrip = None , write_type = np .int16 , data = None ):
371
- """ Generates and possiblly writes a label image that represents self.
376
+ """ Generates and possibly writes a label image that represents self.
372
377
373
378
Parameters
374
379
----------
375
380
path: string, optional
376
381
output image path
377
- descrip: string, optional,
382
+ descrip: string, optional
378
383
descritpion associated with the output image
379
- write_type: string, optional,
384
+ write_type: string, optional
380
385
type of the written data
381
386
data: array os shape (self.k), optional,
382
387
information to write into the image
@@ -461,6 +466,7 @@ def subdomain_from_position_and_image(nim, pos):
461
466
"""
462
467
keeps the set of labels of the image corresponding to a certain index
463
468
so that their position is closest to the prescribed one
469
+
464
470
Parameters
465
471
----------
466
472
mim: NiftiIImage instance, or string path toward such an image
@@ -482,11 +488,11 @@ def subdomain_from_balls(domain, positions, radii):
482
488
Parameters
483
489
----------
484
490
domain: StructuredDomain instance,
485
- the description of a discrete domain
491
+ the description of a discrete domain
486
492
positions: array of shape(k, dim):
487
- the positions of the balls
493
+ the positions of the balls
488
494
radii: array of shape(k):
489
- the sphere radii
495
+ the sphere radii
490
496
"""
491
497
# checks
492
498
if np .size (positions ) == positions .shape [0 ]:
0 commit comments