@@ -357,16 +357,17 @@ def __init__(self, rdr):
357357def set_omero_credentials (omero_server , omero_port , omero_username , omero_password ):
358358 '''Set the credentials to be used to connect to the Omero server
359359
360- omero_server - DNS name of the server
360+ :param omero_server: DNS name of the server
361361
362- omero_port - use this port to connect to the server
362+ :param omero_port: use this port to connect to the server
363363
364- omero_username - log on as this user
364+ :param omero_username: log on as this user
365365
366- omero_password - log on using this password
366+ :param omero_password: log on using this password
367367
368- The session ID is valid after this is called. An exception is thrown
369- if the login fails. omero_logout() can be called to log out.
368+ The session ID is valid after this function is called. An exception is thrown
369+ if the login fails. :func:`bioformats.omero_logout()` can be called to log out.
370+
370371 '''
371372 global __omero_server
372373 global __omero_username
@@ -388,9 +389,10 @@ def set_omero_credentials(omero_server, omero_port, omero_username, omero_passwo
388389 return __omero_session_id
389390
390391def get_omero_credentials ():
391- '''Return a pickleable dictionary representing the Omero credentials
392+ '''Return a pickleable dictionary representing the Omero credentials.
392393
393- Call use_omero_credentials in some other process to use this.
394+ Call :func:`bioformats.use_omero_credentials` in some other process to use this.
395+
394396 '''
395397 if __omero_session_id is None :
396398 omero_login ()
@@ -427,14 +429,17 @@ def omero_login():
427429 return __omero_session_id
428430
429431def omero_logout ():
430- '''Abandon any current Omero session'''
432+ '''Abandon any current Omero session.
433+
434+ '''
431435 global __omero_session_id
432436 __omero_session_id = None
433437
434438def use_omero_credentials (credentials ):
435- '''Use the session ID from an extant login as credentials
439+ '''Use the session ID from an existing login as credentials.
436440
437- credentials - credentials from get_omero_credentials
441+ :param credentials: credentials from get_omero_credentials.
442+
438443 '''
439444 global __omero_server
440445 global __omero_username
@@ -451,12 +456,16 @@ def use_omero_credentials(credentials):
451456
452457__omero_login_fn = None
453458def set_omero_login_hook (fn ):
454- '''Set the function to be called when a login to Omero is needed'''
459+ '''Set the function to be called when a login to Omero is needed.
460+
461+ '''
455462 global __omero_login_fn
456463 __omero_login_fn = fn
457464
458465def get_omero_reader ():
459- '''Return an loci.ome.io.OMEROReader instance, wrapped as a FormatReader'''
466+ '''Return an ``loci.ome.io.OMEROReader`` instance, wrapped as a FormatReader.
467+
468+ '''
460469 script = """
461470 var rdr = new Packages.loci.ome.io.OmeroReader();
462471 rdr.setServer(server);
@@ -492,18 +501,19 @@ def load_using_bioformats_url(url, c=None, z=0, t=0, series=None, index=None,
492501
493502
494503class ImageReader (object ):
495- '''Find the appropriate reader for a file
504+ '''Find the appropriate reader for a file.
496505
497506 This class is meant to be harnessed to a scope like this:
498507
499- with GetImageReader(path) as rdr :
500- ....
508+ >>> with GetImageReader(path) as reader :
509+ >>> ....
501510
502- It uses __enter__ and __exit__ to manage the random access stream
511+ It uses ` __enter__` and ` __exit__` to manage the random access stream
503512 that can be used to cache the file contents in memory.
513+
504514 '''
505-
506- def __init__ (self , path = None , url = None , perform_init = True ):
515+
516+ def __init__ (self , path = None , url = None , perform_init = True ):
507517 self .stream = None
508518 file_scheme = "file:"
509519 self .url = url
@@ -689,17 +699,17 @@ def read(self, c = None, z = 0, t = 0, series = None, index = None,
689699 rescale = True , wants_max_intensity = False , channel_names = None ):
690700 '''Read a single plane from the image reader file.
691701
692- c - read from this channel. None = read color image if multichannel
693- or interleaved RGB
694- z - z-stack index
695- t - time index
696- series - series for .flex and similar multi-stack formats
697- index - if None, fall back to zct, otherwise load the indexed frame
698- rescale - True to rescale the intensity scale to 0 and 1, False to
699- return the raw values native to the file
700- wants_max_intensity - if False, only return the image, if True
702+ :param c: read from this channel. ` None` = read color image if multichannel
703+ or interleaved RGB.
704+ :param z: z-stack index
705+ :param t: time index
706+ :param series: series for `` .flex`` and similar multi-stack formats
707+ :param index: if ` None` , fall back to `` zct`` , otherwise load the indexed frame
708+ :param rescale: ` True` to rescale the intensity scale to 0 and 1; ` False` to
709+ return the raw values native to the file.
710+ :param wants_max_intensity: if ` False`, only return the image; if ` True`,
701711 return a tuple of image and max intensity
702- channel_names - provide the channel names for the OME metadata
712+ :param channel_names: provide the channel names for the OME metadata
703713 '''
704714 FormatTools = make_format_tools_class ()
705715 ChannelSeparator = make_reader_wrapper_class (
@@ -888,14 +898,15 @@ def load_using_bioformats(path, c=None, z=0, t=0, series=None, index=None,
888898 rescale = True ,
889899 wants_max_intensity = False ,
890900 channel_names = None ):
891- '''Load the given image file using the Bioformats library
901+ '''Load the given image file using the Bioformats library.
892902
893- path: path to the file
894- z: the frame index in the z (depth) dimension.
895- t: the frame index in the time dimension.
896- channel_names: None if you don't want them, a list which will be filled if you do
903+ :param path: path to the file
904+ :param z: the frame index in the `z` (depth) dimension.
905+ :param t: the frame index in the time dimension.
906+ :param channel_names: ` None` if you don't want them, a list which will be filled if you do.
897907
898- Returns either a 2-d (grayscale) or 3-d (2-d + 3 RGB planes) image
908+ :returns: either a 2-d (grayscale) or 3-d (2-d + 3 RGB planes) image.
909+
899910 '''
900911
901912 with ImageReader (path = path ) as rdr :
@@ -905,13 +916,13 @@ def load_using_bioformats(path, c=None, z=0, t=0, series=None, index=None,
905916def get_omexml_metadata (path = None , url = None ):
906917 '''Read the OME metadata from a file using Bio-formats
907918
908- path - path to the file
919+ :param path: path to the file
909920
910- allowopenfiles - allow the image reader to open files while looking for
911- the proper reader class.
912-
913- groupfiles - utilize the groupfiles option to take the directory structure
921+ :param groupfiles: utilize the groupfiles option to take the directory structure
914922 into account.
923+
924+ :returns: the metdata as XML.
925+
915926 '''
916927 with ImageReader (path = path , url = url , perform_init = False ) as rdr :
917928 #
0 commit comments