detach
Bring one of a project's resources back to this machine.
from plexora import detachdetach(project, kind, path=None)Removes the node binding recorded by plexora.attach_table,
plexora.attach_image or plexora.attach_segmentation, and points the
project at path instead. The project's own answers about the data --
roles, the marker split, the coordinate source, whether values are
log-transformed -- are untouched: a table that comes home is not a table
that has to be re-imported.
When to use
Call this when a node is being retired, or when a file that was being read remotely has been copied onto this machine, and the project should go back to reading it directly.
Parameters
projectstr | ProjectrequiredThe project to update, by name or object.
kindstrrequiredWhich resource to detach: "image", "segmentation" or
"table".
pathstrdefault NoneWhere the file is on THIS machine. Required for
"image" and "table" -- a project resource on a node has no
local copy by construction. For "segmentation", an empty path
is a real answer: the project no longer has a mask.
Returns
ProjectThe project, saved with the node binding removed and
reloaded so this process serves it. Returned unchanged (and not
reloaded) if kind had no node binding to remove.
Raises
KeyErrorIf kind is not one of "image", "segmentation" or
"table", or project names an unknown project.
ValueErrorIf path is required for kind and not given, or (for
"image") if the file at path cannot be read as an image, or
does not match the image the project was built on.
Examples
import plexora
plexora.detach("tonsil", "table", path="/data/cells.csv")