A really non optimized way for Drawing a Chessboard but a good opportunity to explore the functions available in Image > Stacks, specially those located in the submenu Stacks > Tools.
In this algorithm, we use three functions available in Image > Stacks. They are:
- Image > Stacks > Images to Stack
- Image > Stacks > Tools > Concatenate... In this function, the two stacks can be the same. You don't need the duplication of the original stack.
- Image > Stacks > Tools > Reverse
Fig.1: Steps to create the chessboard from two black and white cells |
The algorithm described in the scheme of Fig. 1 is the following:
- Create two cells: one in black and the other in white with newImage(...).
- Create a 2-slices stack.
- Concatenate two 2-slices stacks.
- Concatenate two 4-slices stacks to create a 8-slices stack: yes ! you get your first row.
- Duplicate the row and reverse the order of the cells.
- Then, concatenate the first two rows of the chessboard (16-slices stack).
- Finally, proceed by successive concatenation to get a 32-slices stack and the 64-slices stack.
- To see the chessboard, compute a montage of 8 rows per 8 columns. Et voilĂ .
+++ IJ snippet +++
+++ End of IJ snippet +++
These functions are really useful to edit small videos loaded as stacks (maybe the subject of a post).
No comments:
Post a Comment