decode.renderer package#

Submodules#

decode.renderer.renderer module#

class decode.renderer.renderer.Renderer(plot_axis, xextent, yextent, zextent, px_size, abs_clip, rel_clip, contrast)[source]#

Bases: ABC

Renderer. Takes emitters and outputs a rendered image.

forward(em)[source]#

Forward emitterset through rendering and output rendered data.

Parameters:

em (EmitterSet) – emitter set

Return type:

Tensor

render(em, ax=None)[source]#

Render emitters

Parameters:
  • em (EmitterSet) – emitter set

  • ax – plot axis

class decode.renderer.renderer.Renderer2D(px_size, sigma_blur, plot_axis=(0, 1, 2), xextent=None, yextent=None, zextent=None, colextent=None, abs_clip=None, rel_clip=None, contrast=1)[source]#

Bases: Renderer

2D histogram renderer with constant gaussian blur.

Parameters:
  • px_size – pixel size of the output image in nm

  • sigma_blur – sigma of the gaussian blur applied in nm

  • plot_axis – determines which dimensions get plotted. 0,1,2 = x,y,z. (0,1) is x over y.

  • xextent – extent in x in nm

  • yextent – extent in y in nm

  • zextent – extent in z in nm.

  • cextent – extent of the color variable. Values outside of this range get clipped.

  • abs_clip – absolute clipping value of the histogram in counts

  • rel_clip – clipping value relative to the maximum count. i.e. rel_clip = 0.8 clips at 0.8*hist.max()

  • contrast – scaling factor to increase contrast

forward(em, col_vec=None)[source]#

Forward emitterset through rendering and output rendered data.

Parameters:
  • em (EmitterSet) – emitter set

  • col_vec – torch tensor (1 dim) with the same length as em

Return type:

Tensor

get_extent(em)[source]#
Return type:

Tuple[tuple, tuple, tuple]

render(em, col_vec=None, ax=None)[source]#

Forward emitterset through rendering and output rendered data.

Parameters:
  • em (EmitterSet) – emitter set

  • col_vec – torch tensor (1 dim) with the same length as em

  • ax – plot axis

class decode.renderer.renderer.RendererIndividual2D(px_size, batch_size=1000, filt_size=10, plot_axis=(0, 1), xextent=None, yextent=None, zextent=None, colextent=None, abs_clip=None, rel_clip=None, contrast=1, intensity_field='sigma', device='cpu')[source]#

Bases: Renderer2D

2D histogram renderer. Each localization is individually rendered as a 2D Gaussian corresponding to a respective field.

Parameters:
  • px_size – pixel size of the output image in nm

  • batch_size – number of localization processed in parallel

  • filt_size – each gaussian is calculated as a patch with size filt_size*filt_size (in pixels)

  • plot_axis – determines which dimensions get plotted. 0,1,2 = x,y,z. (0,1) is x over y.

  • xextent – extent in x in nm

  • yextent – extent in y in nm

  • zextent – extent in z in nm.

  • cextent – extent of the color variable. Values outside of this range get clipped.

  • abs_clip – absolute clipping value of the histogram in counts

  • rel_clip – clipping value relative to the maximum count. i.e. rel_clip = 0.8 clips at 0.8*hist.max()

  • contrast – scaling factor to increase contrast

  • intensity_field – field of emitter that should be used for rendering

  • device – render on cpu or cuda

calc_gaussians(xy_mu, xy_sig, mesh)[source]#

Module contents#