Added command line options to swap axes, disable interpolation, and output tile positions as a csv#244
Added command line options to swap axes, disable interpolation, and output tile positions as a csv#244njbradley wants to merge 2 commits into
Conversation
…utput tile positions as a csv
|
Thanks! I've been meaning to add the functionality of no-resample and output-positions for a while! No-resample definitely speeds up the output image generation dramatically as the bulk of the time there is spent filtering for the sub-pixel shift. The tile paste code already detects when the coordinates are integers and skips the subpixel shift entirely. I had meant to do some comparisons on cell segmentation and quantification accuracy with and without the sub-pixel shift but I haven't gotten around to it. I never considered transpose -- can you explain more about the circumstances that require it? I'll give this code a look over the next few days. |
|
I'm glad to hear you've been wanting to add some of these features! Hopefully I can save you some work here For no-resample in the end I just added an extra argument to the paste function that controls if shifting happens, and rounds to integers if not. I did see that it is disabled when the image position is integral but I didn't want to mess too much with the code, if there is a cleaner way for me to do it definitely let me know, I can make some changes. Thinking about it more, if I'm rounding the positions to integers at the final step, is it even worth doing the alignment to sub-pixel precision? Maybe disabling that is all that needs to happen, as that would result in integer positions even after the spanning tree. I needed to add transpose when I was working on some nd2 files that must've had a kinda messed up microscope configuration, and basically the stage positions recorded in the file were rotated by 90 degrees compared to the images, which I was able to fix using transpose and flip-y. It's probably not something you need in normal usage, but when dealing with image formats that are annoying to edit like nd2 it saved me a lot of work. There also might be a better name for it, maybe swap-axes? |
I've been using ashlar for a bit to stitch various image sets, and it has worked great, thanks for making this package! In dealing with some weird nd2 files and tile patterns, I ended up adding a couple command line flags, and I figured I would see if you guys think they would be worth merging in.
The options I added are:
--transpose, which swaps the x and y axes of the input tile positions. I had this happen before the flip x and y flags happen, but it could also happen after, depending on what you think is best.--no-resample, which disables shifting images to a fractional pixel location and instead rounds the position to the nearest integer. In my case I had small features that were getting somewhat blurred by the shifting and so I wanted to disable it, but I imagine it also saves on processing time when combining images.--output-positions, which instead of saving an output image saves the aligned positions of each tile to a csv file. I wasn't sure the best way for this to work with the output flag, right now no images are saved even if the-oflag is specified. It would probably be better to issue an error if both are specified, or generate both.Let me know what you guys think of these additions,