fnet.data package

Submodules

fnet.data.aicsczidataset module

fnet.data.bufferedpatchdataset module

class fnet.data.bufferedpatchdataset.BufferedPatchDataset(dataset: collections.abc.Sequence, patch_shape: Sequence[int] = (32, 64, 64), buffer_size: int = 1, buffer_switch_interval: int = -1, shuffle_images: bool = True)[source]

Bases: object

Provides patches from items of a dataset.

Parameters:
  • dataset – Dataset object.
  • patch_shape – Shape of patch to be extracted from dataset items.
  • buffer_size – Size of buffer.
  • buffer_switch_interval – Number of patches provided between buffer item exchanges. Set to -1 to disable exchanges.
  • shuffle_images – Set to randomize order of dataset item insertion into buffer.
get_batch(batch_size: int) → Sequence[torch.Tensor][source]

Returns a batch of patches.

Parameters:batch_size – Number of patches in batch.
Returns:Batch of patches.
Return type:Sequence[torch.Tensor]
get_buffer_history() → List[int][source]

Returns a list of indices of dataset elements inserted into the buffer.

Returns:Indices of dataset elements.
Return type:List[int]
get_random_patch() → List[Union[numpy.ndarray, torch.Tensor]][source]

Samples random patch from an item in the buffer.

Let nd be the number of dimensions of the patch. If the item has more dimensions than the patch, then sampling will be from the last nd dimensions of the item.

Returns:Random patch sampled from a dataset item.
Return type:List[ArrayLike]
insert_new_element_into_buffer() → None[source]

Inserts new dataset item into buffer.

Returns:
Return type:None

fnet.data.czidataset module

fnet.data.czireader module

fnet.data.dummychunkdataset module

fnet.data.fnetdataset module

class fnet.data.fnetdataset.FnetDataset(dataframe: Optional[pandas.core.frame.DataFrame] = None, path_csv: Optional[str] = None, transform_signal: Optional[list] = None, transform_target: Optional[list] = None)[source]

Bases: torch.utils.data.dataset.Dataset

Abstract class for fnet datasets.

Parameters:
  • dataframe – DataFrame where rows are dataset elements. Overrides path_csv.
  • path_csv – Path to csv from which to create DataFrame.
  • transform_signal – List of transforms to apply to signal image.
  • transform_target – List of transforms to apply to target image.
get_information(index) → Union[dict, str][source]

Returns information to identify dataset element specified by index.

metadata

Returns metadata about the dataset.

fnet.data.tiffdataset module

class fnet.data.tiffdataset.TiffDataset(col_index: Optional[str] = None, col_signal: str = 'path_signal', col_target: str = 'path_target', col_weight_map: str = 'path_weight_map', augment: bool = False, **kwargs)[source]

Bases: fnet.data.fnetdataset.FnetDataset

Dataset where each row is a signal-target pairing from TIFF files.

Dataset items will be 2-item or 3-item tuples:
(signal image, target image) or (signal image, target image, cost map)
Parameters:augment – Set to augment dataset with flips about the x and/or y axis.
get_information(idx: int) → dict[source]

Returns information about the dataset item.

Parameters:idx – Index of dataset item for which to retrieve information.
Returns:Information about dataset item.
Return type:dict

fnet.data.tifreader module

Module contents

class fnet.data.BufferedPatchDataset(dataset: collections.abc.Sequence, patch_shape: Sequence[int] = (32, 64, 64), buffer_size: int = 1, buffer_switch_interval: int = -1, shuffle_images: bool = True)[source]

Bases: object

Provides patches from items of a dataset.

Parameters:
  • dataset – Dataset object.
  • patch_shape – Shape of patch to be extracted from dataset items.
  • buffer_size – Size of buffer.
  • buffer_switch_interval – Number of patches provided between buffer item exchanges. Set to -1 to disable exchanges.
  • shuffle_images – Set to randomize order of dataset item insertion into buffer.
get_batch(batch_size: int) → Sequence[torch.Tensor][source]

Returns a batch of patches.

Parameters:batch_size – Number of patches in batch.
Returns:Batch of patches.
Return type:Sequence[torch.Tensor]
get_buffer_history() → List[int][source]

Returns a list of indices of dataset elements inserted into the buffer.

Returns:Indices of dataset elements.
Return type:List[int]
get_random_patch() → List[Union[numpy.ndarray, torch.Tensor]][source]

Samples random patch from an item in the buffer.

Let nd be the number of dimensions of the patch. If the item has more dimensions than the patch, then sampling will be from the last nd dimensions of the item.

Returns:Random patch sampled from a dataset item.
Return type:List[ArrayLike]
insert_new_element_into_buffer() → None[source]

Inserts new dataset item into buffer.

Returns:
Return type:None
class fnet.data.FnetDataset(dataframe: Optional[pandas.core.frame.DataFrame] = None, path_csv: Optional[str] = None, transform_signal: Optional[list] = None, transform_target: Optional[list] = None)[source]

Bases: torch.utils.data.dataset.Dataset

Abstract class for fnet datasets.

Parameters:
  • dataframe – DataFrame where rows are dataset elements. Overrides path_csv.
  • path_csv – Path to csv from which to create DataFrame.
  • transform_signal – List of transforms to apply to signal image.
  • transform_target – List of transforms to apply to target image.
get_information(index) → Union[dict, str][source]

Returns information to identify dataset element specified by index.

metadata

Returns metadata about the dataset.

class fnet.data.TiffDataset(col_index: Optional[str] = None, col_signal: str = 'path_signal', col_target: str = 'path_target', col_weight_map: str = 'path_weight_map', augment: bool = False, **kwargs)[source]

Bases: fnet.data.fnetdataset.FnetDataset

Dataset where each row is a signal-target pairing from TIFF files.

Dataset items will be 2-item or 3-item tuples:
(signal image, target image) or (signal image, target image, cost map)
Parameters:augment – Set to augment dataset with flips about the x and/or y axis.
get_information(idx: int) → dict[source]

Returns information about the dataset item.

Parameters:idx – Index of dataset item for which to retrieve information.
Returns:Information about dataset item.
Return type:dict
class fnet.data.MultiChTiffDataset(dataframe: pandas.core.frame.DataFrame = None, path_csv: str = None, transform_signal=None, transform_target=None)[source]

Bases: fnet.data.fnetdataset.FnetDataset

Dataset for multi-channel tiff files.

Currently assumes that images are loaded in ZCXY format

get_information(index: int) → dict[source]

Returns information to identify dataset element specified by index.