-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unstiched image #526
Comments
Hi Elena, Since you're already in Python, it might be a lot easier to just run the Python version of BaSiC (https://basicpy.readthedocs.io/en/latest/) on tiles without overlap, then assemble everything back into the original grid. Modify your for loop to store tiles in a list: tiles = []
for i in range(num_rows):
for j in range(num_columns):
# cut out tiles without overlap
tile = image.crop((x1, y1, x2, y2))
tiles.append(tile) Then you can pass the whole list to BaSiC with: from basicpy import BaSiC
import numpy as np
basic = BaSiC(get_darkfield=True)
basic.fit(np.stack(tiles))
corrected_tiles = basic.transform(np.stack(tiles))
# After this, reassemble corrected_tiles based on the original grid |
Thank you for answering quickly
|
Hi @Elena983, How did you decide on 600x600 for your tile size? BaSiC works best when the tiles share the same illumination profile, and the error message suggests that your tiles don't. Typically, the tiles would be darker along the edges, which results in a dark grid in the fully stitched image (see Figure 1a in https://www.nature.com/articles/ncomms14836). Does your choice of 600x600 line up with the dark grid in your image? -Artem |
Hi Artem I have no lack, as I received again the same error.
What other options exist for the BaSiC (not py)? |
Hi @Elena983 can you confirm how you are selecting the tile sizes? I see you went from 600x600 to something else. How are you picking these? |
Can you tell us what microscope (manufacturer and model, and ideally the manufacturer and model of the camera device) you used to acquire the original image? That could help determine the correct dimensions for untiling. I am not sure the BaSiC algorithm will necessarily work properly on tiles that have been split out from a previously stitched image -- the method used for blending the tile overlaps will probably affect how BaSiC's statistical model of illumination errors works. |
Hi |
Hi |
Hi @Elena983 , BaSiC cannot run on tiles that have been cut using some arbitrary number. The tiles that go into BaSiC need to have been illuminated by the same underlying flat field pattern. If you take a stack of tiles that have been cut by some random size, then the pattern will be different for each tile and then BaSiC cannot estimate what the common pattern is across these tiles (please see @ArtemSokolov 's earlier message that references the BaSiC paper). As @jmuhlich mentioned, it's much better (maybe even necessary) to use raw unstitched tiles. |
Hi Clarence |
Hi @Elena983 , each cycle was in its own folder called 'Cycle_00*'. Inside each cycle folder, there is a tiff file for each channel and each tile. So if you have 4 channels and 100 tiles, you will have 400 files. The filename convention was like this: Ch_1_Slice_01_Row_01_Col_01.tiff for the first tile and channel. Sorry but I now remember that I had to run BaSiC and ASHLAR manually as standalone tools to get this to work. Because the tiff files do not have a master index file, I had to run BaSiC through ImageJ, not MCMICRO. For ASHLAR, I used the fileseries loader to load the cycle subfolders and flat field profiles from BaSiC. The resulting stitched images looked fine after that. |
Hi Artem
I would like to use the BaSiC module, but our device only provides the already stitched and aligned image.
So, I've done the code to divide into tiles with overlapping, I need to name the tiles, so they then correctly may be assembled in ashlar.
Code the next
from PIL import Image
The text was updated successfully, but these errors were encountered: