spacetx / starfish

starfish: unified pipelines for image-based transcriptomics
https://spacetx-starfish.readthedocs.io/en/latest/
MIT License
225 stars 67 forks source link

registration in starfish, Part 3: implement image / spot registration in IntensityTable #410

Open berl opened 6 years ago

berl commented 6 years ago

A potentially very useful aspect of the IntensityTable as a data structure for pixel intensities is that it provides an alternative location to execute (approximate*) rigid image transformations. Instead of the current approach of registering images by translating the pixels in images, we could simply translate the x,y,z locations of intensity values in the IntensityTable. Currently IntensityTable.from_image_stack() takes those x,y,z values from the image data shape (modulo a crop that is symmetric on both sides).

Even for the spot-based IntensityTable, the relative translation of different channels within a FOV could be implemented here, pulling the translation shift values directly from the SlicedImage.

*just moving the pixel locations in an IntensityTable is not strictly the same as a proper affine transformation of the image, wherein pixel intensity values are modified to reflect resampling across pixels. For the current SpaceTx labeling and imaging technologies, my gut feeling is that this discrepancy wouldn't make a difference, but it would have to be tested.

dganguli commented 6 years ago

Naiive question: Would shifting pixel values, as opposed to literally translating pixels as we do now, still be a viable strategy for the multiplexed methods? The latter is certainly easier to intuit about. I think for non-multiplexed methods it probably doesn't matter?

berl commented 6 years ago

@dganguli I bet it will work fine for the rolony methods where the blobs are big. It may start to break down for methods with diffraction limited spots that have a sigma of ~1 pixel and need subpixel registration, but at that point I think that the precision of the calculated translation, residual optical aberrations, etc. become just as important. Also, I just realized that if you really needed an image back, you could do your interpolation and resampling then when you're populating pixel values.