DeepTrackAI / DeepTrack2

DeepTrack2
MIT License
157 stars 47 forks source link

BrightField particle has wrong position #176

Closed litpuvn closed 1 year ago

litpuvn commented 1 year ago

Re-run the tracking particle using cnn, and i found that the particle didn't display correctly. The position looks like at (15, 15). However, its real position is (32, 32). Get position method also returns (32, 32) as initial setting.

Running on Ubuntu 22, python 3.9.12

mie_particle = dt.MieSphere(                                         
    refractive_index=1.58,
    radius=0.5e-6,
    position=(32, 32),
    position_unit='pixel',
)

IMAGE_SIZE = 64

brightfield_microscope = dt.Brightfield(
    NA=0.9,                
    resolution=1e-6,     
    magnification=10,
    wavelength=680e-9,
    output_region=(0, 0, IMAGE_SIZE, IMAGE_SIZE),
    padding=(32, 32, 32, 32),
    upscale=2
)

imaged_particle = brightfield_microscope(mie_particle)

output_image = imaged_particle.update().resolve()

plt.imshow(np.squeeze(output_image), cmap='gray')
plt.show()
BenjaminMidtvedt commented 1 year ago

You can remove upscale=2 and the particle is positioned correctly again. There seems to be a bug with upscale. I'll look into it.