Skip to content

return an Image Class without any properties if upscale > 1 #325

Description

@JChonpca

DeepTrack Version: 2.0.1
Platform Version: Ubuntu 22.04.3 LTS
Python Version: 3.9.12

If upscale > 1 in Optical Class, then return an Image Class without any properties after calling the store_properties method.

This may be a bug, since I see similar code that uses the properties returned in the Image class with the condition that upscale = 4. But in this similar code, the DeepTrack version remains unknown (<=1.7 since it use Tensorflow).

Code:

from deeptrack.optics import Fluorescence
from deeptrack.scatterers import PointParticle
from deeptrack import Arguments

upscale_para = Arguments(upscale=1)

optics = Fluorescence(
    NA=0.7,
    wavelength=660e-9,
    resolution=1e-6, 
    magnification=10,
    refractive_index_medium=1.33,
    upscale=upscale_para.upscale,
    padding=(10, 10, 10, 10),
    output_region=(0, 0, 64, 64), 
    aberration=None,
)

scatterer = PointParticle(
    intensity=100,
    position_unit="pixel",
    position=(32, 32),
)

imaged_scatterer = optics(scatterer).bind_arguments(upscale_para)

imaged_scatterer.store_properties()

p1 = imaged_scatterer(upscale=1)
print(p1.properties)

p2 = imaged_scatterer(upscale=2)
print(p2.properties)

p3 = imaged_scatterer(upscale=3)
print(p3.properties)

p4 = imaged_scatterer(upscale=4)
print(p4.properties)

Output:

[{'position': array([32, 32]), 'z': 0.0, 'value': 1.0, 'position_unit': 'pixel', 'upsample': 1, 'voxel_size': array([1.e-07, 1.e-07, 1.e-07]), 'pixel_size': 1e-07, '_position_sampler': (32, 32), 'upsample_axes': (), 'intensity': 100, 'name': 'Fluorescence'}, {'NA': 0.7, 'wavelength': 6.6e-07, 'refractive_index_medium': 1.33, 'magnification': 10, 'resolution': 1e-06, 'padding': [10, 10, 10, 10], 'output_region': [0, 0, 64, 64], 'voxel_size': array([1.e-07, 1.e-07, 1.e-07]), 'pixel_size': 1e-07, 'upscale': 1, 'limits': array([[30, 35],
       [30, 35],
       [-2,  3]], dtype=int32), 'fields': [], 'aberration': None, 'name': 'Fluorescence'}, {'upscale': 1, 'name': 'Arguments'}, {'name': 'Microscope'}]
[{'upscale': 2, 'name': 'Arguments'}, {'name': 'Microscope'}]
[{'upscale': 3, 'name': 'Arguments'}, {'name': 'Microscope'}]
[{'upscale': 4, 'name': 'Arguments'}, {'name': 'Microscope'}]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

resolvedThe issue has been resolved

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions