PolarizedLightFieldMicroscopy / BirTomo

Geometrical Birefringence Tomography
BSD 3-Clause "New" or "Revised" License
4 stars 2 forks source link

Indexing to retrieve Siddon algorithm outputs #86

Closed gschlafly closed 9 months ago

gschlafly commented 9 months ago

Description

When compute_ray_collisions() is called, the input volume shape should be large enough so that all the relevant collision indices are extracted. https://github.com/PolarizedLightFieldMicroscopy/GeoBirT/blob/59cb8904bdfd36be12725dc3013950b81ff8b461/VolumeRaytraceLFM/abstract_classes.py#L484-L488

With one microlens and a volume of shape $(3,7,7)$, the only indices that are said to have collisions are $(1,0,0)$, $(2,0,0)$, and $(3,0,0)$. However, the rays definitely pass through voxels where $y\neq0$ or $z\neq0$.

When using the complete volume shape to compute the collision indices, voxels where $y\neq0$ or $z\neq0$ are collected. Although, some tests fail due to IndexError.

Screenshots

image

Files

To Reproduce

Replace _abstractclasses.py#L484-L488 with the following:

ray_valid_indices_by_ray_num, ray_vol_colli_indices, ray_vol_colli_lengths, ray_valid_direction = \
    self.compute_ray_collisions(
        ray_enter, ray_exit, self.optical_info['voxel_size_um'], self.optical_info['volume_shape']
    )

and then run the test test_all.py::test_forward_projection_different_volumes[single_voxel].

gschlafly commented 9 months ago

The choice to use a restricted set of the volume shape was made it commit 3c3c6c94c6575851501c68c1a9f3a2bf265df7fd.

gschlafly commented 9 months ago

Actually, the same volume set was used in https://github.com/PolarizedLightFieldMicroscopy/GeoBirT/commit/3c3c6c94c6575851501c68c1a9f3a2bf265df7fd. Only the variable name was changed to indicate that the volume shape being used to ray trace through the volume was different than that of the original volume.

gschlafly commented 9 months ago

Applying the Siddon algorithm to self.vol_shape_restricted instead of the entire volume is done so that only the object directly under the MLA is captured in the model. Since only one microlens was used and the supersampling was one, only one voxel width fits under the MLA. This is why Siddon information is collected for only the voxels $(1,0,0)$, $(2,0,0)$, and $(3,0,0)$.