Multi-Resolution Stacks

75 views
Skip to first unread message

Marcel Sayre

unread,
Nov 7, 2019, 10:58:59 AM11/7/19
to CATMAID
Hi all,

I have a data set with multiple stacks that are different resolutions (i.e. different pixel scales; an overview of 50 nm x 50 nm x 50nm plus higher res stacks at 24 x 24 x 50 and 11.5 x 11.5 x 50). The stacks have already been co-registered to each other in Amira and I have the bounding box coordinates. My goal is to use CATMAID to view them simultaneously and trace neurons as they project from one into the other. Albert introduced me to the Hildebrand et al. 2017 paper (https://www.nature.com/articles/nature22356/) where they managed to do this successfully.

Can anyone explain to me how this is done? I have already imported two stacks to test this, but have had no luck viewing them simultaneously, one imposed on the other.

I'm also having a second issue: while viewing a stack, I am able to scroll through the z-index using the mouse wheel, however when I left-click and grab the image to try and drag it in the x-y direction, it also scrolls in the z-direction. It moves the stack back to the 0 slice regardless of reach direction I drag the image. Any ideas what I might've done wrong here? The stack was exported for CATMAID using TrakEM2 and was uploaded using the tile source 4 type.

Many thanks for any advice!
Kind regards,
Marcel

Tom Kazimiers

unread,
Nov 7, 2019, 11:55:26 AM11/7/19
to cat...@googlegroups.com
Hi Marcel,

What CATMAID version are you running?

On Thu, Nov 07, 2019 at 07:58:59AM -0800, Marcel Sayre wrote:
>Can anyone explain to me how this is done? I have already imported two
>stacks to test this, but have had no luck viewing them simultaneously, one
>imposed on the other.

For this to work properly you need to make sure to use WebGL for the
image data rendering. This is the default since a while, but you can
double check this is enabled by opening the layer settings with the help
of the small blue/white box in the lower left corner of a stack viewer.
The WebGL setting should be enabled for each image data layer. Whether
CATMAID attempts to use WebGL as default can be checked in the Settings
Widget, Stack view > Prefer WebGL layers.

Once you are sure WebGL is enabled, locate the blend mode setting in the
layer settings for each image layer. If you set it to "add", it should
use additive blending and show all image layers simultaneously.

These overlays can also be seen in the Z slice rendering of the 3D
viewer.

>I'm also having a second issue: while viewing a stack, I am able to
>scroll
>through the z-index using the mouse wheel, however when I left-click and
>grab the image to try and drag it in the x-y direction, it also scrolls in
>the z-direction. It moves the stack back to the 0 slice regardless of reach
>direction I drag the image. Any ideas what I might've done wrong here? The
>stack was exported for CATMAID using TrakEM2 and was uploaded using the
>tile source 4 type.

Hm, this doesn't happen on my setups. I suppose you see this in
navigation mode (i.e. the navigation tool is selected in the top
toolbar)? Does this also happen if you use the right mouse button with
the tracing tool active?

Would you mind opening the developer tools of the browser (menu > more
tools > developer tools in chromium/chrome) and locate the console. Does
it show any error?

Also, do you happen to use LastPass? We have seen some weird input
element interaction with it in the past. I believe I fixed everything in
that regard, but would like to double check.

Best,
Tom

Marcel Sayre

unread,
Nov 11, 2019, 10:31:39 AM11/11/19
to CATMAID
Hello Tom,

Thanks for your response! I'm using the CATMAID version that was released on 2019-06-20. I haven't tried viewing the combined stacks yet because I'm now encountering a new error that I think may be related to having incorrectly imported one of the stacks. When I open my second stack in the CATMAID viewer, I get an error "Stack mirror unavailable..." However, after I zoom in past 1, the stack appears. After looking at the actual tiles in the data folder, I noticed that there are no tiles with canary location "0_0_0.jpg", the first tile is "0_3.jpg". There is also no "small.jpg". I've tried exporting the same stack from TrakEM2 using both directory structure options, but I have the same issue with both. I've attached the Chrome error log here. Any idea why this might be? Would you recommend I use a different method for converting .tif stacks to CATMAID image tiles? 

I fixed the second issue I was having by changing the translation values in the admin webpage. I used values based on the coordinates of the bounding box I extracted from Amira, however they were all negative values (I'm not sure if this has anything to do with the issue), but when I replaced them with "0" I was able to move through the stack using the navigation tool as usual. 

Thanks!
Marcel 




chrome_log.png

Marcel Sayre

unread,
Jan 23, 2020, 3:22:40 AM1/23/20
to CATMAID
Hi Tom, I'd just like to re-post this for a follow up if possible. Can this issue be solved by changing the name of the canary tile that the CATMAID importer searches for? The canary tile name is different across my stacks (i.e. in one it is "0_0.jpg" while in  another it is "0_3.jpg").

Thanks!
Marcel


On Tuesday, November 12, 2019 at 1:31:39 AM UTC+10, Marcel Sayre wrote:
Hello Tom,

Thanks for your response! I'm using the CATMAID version that was released on 2019-06-20. I haven't tried viewing the combined stacks yet because I'm now encountering a new error that I think may be related to having incorrectly imported one of the stacks. When I open my second stack in the CATMAID viewer, I get an error "Stack mirror unavailable..." However, after I zoom in past 1, the stack appears. After looking at the actual tiles in the data folder, I noticed that there are no tiles with canary location "0_0_0.jpg", the first tile is "0_3.jpg". There is also no "small.jpg". I've tried exporting the same stack from TrakEM2 using both directory structure options, but I have the same issue with both. I've attached the Chrome error log here. Any idea why this might be?

Andrew Champion

unread,
Jan 23, 2020, 6:29:08 AM1/23/20
to cat...@googlegroups.com
Hi Marcel,

CATMAID doesn't look for a fixed canary tile by name, but based on the configured "canary location" for the stack. This location is in stack space (i.e., pixels) at scale level zero. So if you had 256 square tiles and three levels to your scale pyramid, a location in the 0_3 tile (if your tiles are y_x, don't know which source type you are using) would begin around [3 * 2^(3-1) * 256 = 3072, 0, 0]. You can configure this canary location for the stack through the admin interface; it's near the bottom of the stack fields just above the "Project Stacks" section.

Best,

Andrew

--
You received this message because you are subscribed to the Google Groups "CATMAID" group.
To unsubscribe from this group and stop receiving emails from it, send an email to catmaid+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/catmaid/d1c58733-8b4b-4977-9c75-ab1d3c80b401%40googlegroups.com.

Marcel Sayre

unread,
Jan 29, 2020, 8:11:36 PM1/29/20
to CATMAID
Hi Andrew,

That worked! Thanks so much for that clarification! 

All the best,
Marcel


On Thursday, January 23, 2020 at 9:29:08 PM UTC+10, Andrew Champion wrote:
Hi Marcel,

CATMAID doesn't look for a fixed canary tile by name, but based on the configured "canary location" for the stack. This location is in stack space (i.e., pixels) at scale level zero. So if you had 256 square tiles and three levels to your scale pyramid, a location in the 0_3 tile (if your tiles are y_x, don't know which source type you are using) would begin around [3 * 2^(3-1) * 256 = 3072, 0, 0]. You can configure this canary location for the stack through the admin interface; it's near the bottom of the stack fields just above the "Project Stacks" section.

Best,

Andrew

On Thu, Jan 23, 2020 at 8:22 AM Marcel Sayre <marce...@gmail.com> wrote:
Hi Tom, I'd just like to re-post this for a follow up if possible. Can this issue be solved by changing the name of the canary tile that the CATMAID importer searches for? The canary tile name is different across my stacks (i.e. in one it is "0_0.jpg" while in  another it is "0_3.jpg").

Thanks!
Marcel


On Tuesday, November 12, 2019 at 1:31:39 AM UTC+10, Marcel Sayre wrote:
Hello Tom,

Thanks for your response! I'm using the CATMAID version that was released on 2019-06-20. I haven't tried viewing the combined stacks yet because I'm now encountering a new error that I think may be related to having incorrectly imported one of the stacks. When I open my second stack in the CATMAID viewer, I get an error "Stack mirror unavailable..." However, after I zoom in past 1, the stack appears. After looking at the actual tiles in the data folder, I noticed that there are no tiles with canary location "0_0_0.jpg", the first tile is "0_3.jpg". There is also no "small.jpg". I've tried exporting the same stack from TrakEM2 using both directory structure options, but I have the same issue with both. I've attached the Chrome error log here. Any idea why this might be?

I fixed the second issue I was having by changing the translation values in the admin webpage. I used values based on the coordinates of the bounding box I extracted from Amira, however they were all negative values (I'm not sure if this has anything to do with the issue), but when I replaced them with "0" I was able to move through the stack using the navigation tool as usual. 

Thanks!
Marcel 




--
You received this message because you are subscribed to the Google Groups "CATMAID" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cat...@googlegroups.com.

Marcel Sayre

unread,
Mar 23, 2020, 4:18:33 AM3/23/20
to CATMAID
Hi everyone, 

I'm trying now to import a new set of stacks and am again having issues with the stack mirror (likely because of using incorrect values for the "canary location"). Although Andrew's comment below worked for that particular stack, I still don't quite understand what a canary location actually is, why it's important, or how to calculate these values for any given stack. Any advice would be greatly appreciated!

Here are the details for the stack I am now trying to import:

Tile Source Type: Type 4 (section/scalepower/y_x.ext) (exported from TrakEM2 using default settings)
Zoom levels: 4 (four folders were exported for each section  - "0",  "1",  "2",  & "3" so I'm assuming this equals 4 zoom levels?)
First tile in zoom level 0 folder: 3_6.jpg
Tile size: 256 x 256
Number of tiles in zoom level 0 folder: 674

For the formula Andrew wrote below [3 * 2^(3-1) * 256 = 3072, 0, 0] --- am I correct in assuming this is  zoom level *  2^(x-1) * tile-size = [x, 0, 0]? Would I do this for y as well? 

Thanks for any input! I hope you all are staying healthy out there. 

Take care,
Marcel


On Thursday, January 23, 2020 at 9:29:08 PM UTC+10, Andrew Champion wrote:
Hi Marcel,

CATMAID doesn't look for a fixed canary tile by name, but based on the configured "canary location" for the stack. This location is in stack space (i.e., pixels) at scale level zero. So if you had 256 square tiles and three levels to your scale pyramid, a location in the 0_3 tile (if your tiles are y_x, don't know which source type you are using) would begin around [3 * 2^(3-1) * 256 = 3072, 0, 0]. You can configure this canary location for the stack through the admin interface; it's near the bottom of the stack fields just above the "Project Stacks" section.

Best,

Andrew

On Thu, Jan 23, 2020 at 8:22 AM Marcel Sayre <marce...@gmail.com> wrote:
Hi Tom, I'd just like to re-post this for a follow up if possible. Can this issue be solved by changing the name of the canary tile that the CATMAID importer searches for? The canary tile name is different across my stacks (i.e. in one it is "0_0.jpg" while in  another it is "0_3.jpg").

Thanks!
Marcel


On Tuesday, November 12, 2019 at 1:31:39 AM UTC+10, Marcel Sayre wrote:
Hello Tom,

Thanks for your response! I'm using the CATMAID version that was released on 2019-06-20. I haven't tried viewing the combined stacks yet because I'm now encountering a new error that I think may be related to having incorrectly imported one of the stacks. When I open my second stack in the CATMAID viewer, I get an error "Stack mirror unavailable..." However, after I zoom in past 1, the stack appears. After looking at the actual tiles in the data folder, I noticed that there are no tiles with canary location "0_0_0.jpg", the first tile is "0_3.jpg". There is also no "small.jpg". I've tried exporting the same stack from TrakEM2 using both directory structure options, but I have the same issue with both. I've attached the Chrome error log here. Any idea why this might be?

I fixed the second issue I was having by changing the translation values in the admin webpage. I used values based on the coordinates of the bounding box I extracted from Amira, however they were all negative values (I'm not sure if this has anything to do with the issue), but when I replaced them with "0" I was able to move through the stack using the navigation tool as usual. 

Thanks!
Marcel 




--
You received this message because you are subscribed to the Google Groups "CATMAID" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cat...@googlegroups.com.

Sanja Jasek

unread,
Mar 23, 2020, 8:06:48 PM3/23/20
to CATMAID
Hi Marcel,

The canary is an indicator if the stack is available or not. Catmaid checks in first only one location (one tile) and if that tile doesn't exits, it assumes the whole stack mirror doesn't exist and moves on to the next stack mirror, for which it again checks the canary... Anyway, the default canary location is x=0, y=0, Z=0, which is fine in most cases. But if, for example, your stack starts on layer 5 because the first 4 layers you set aside to scan later, then you would put the z=5 for your canary location. But if there are no more mirrors, it gives a warning, but it still shows any images in the "non-existent" mirror. Observe the warning in the attached screenshot. This is a stack which has layers (z) 0-230 available, but I put the canary at 0,0,5000 (z that doesn't exist). The stack is still shown, it just also shows the annoying warning.
In your case, looking at the screenshot in the previous post it looks like you can see your stack. In this email you say you used default TrakEM2 settings to export - and the default is that it doesn't export empty (completely black) tiles. Catmaid still looks for them and you get the 404 response from the server. If you see all the actual content you can just ignore these. Otherwise try exporting with "skip empty tiles" unclicked.

Best regards,
Sanja
canary_example.png

Sanja Jasek

unread,
Mar 23, 2020, 8:22:25 PM3/23/20
to CATMAID
Also keep in mind when skipping empty tiles (TrakEM2 default) - the canary is in the upper left corner which is often empty (black) when you have a full body/bran stack. Which means this tile will not be exported with default TrakEM2 settings. So the default canary is not there, and catmaid warns you that the stack mirror is unavailable. If you don't want to re-export and include the empty tiles, then put the canary xy location somewhere in the middle of the layer.

Tom Kazimiers

unread,
Mar 24, 2020, 1:01:41 AM3/24/20
to cat...@googlegroups.com
Hi Marcel and Sanja,

A brief comment on the empty tiles: you don't need to export them from
TrakEM2 and I don't think we have any dataset where they actually have
more than one black tile stored. What we do instead is tell the
Webserver to try looking for a requested tile and if it is not available
return the one black tile. In Nginx this could look like the following:

location ~ /tracing/tiles/my-dataset/([^/]+/([0-9]+).*)$ {
try_files /path/to/tiles/of/dataset/$1 /path/to/tiles/of/dataset/black.jpg =404;
log_not_found off;
access_log off;
}

This first tries to access the tile and if that's not available it
resorts to the black.jpg tile that has the correct dimensions and only
if that's not available return a 404.

The purpose of canary tiles was already explained very well by Sanja.
Thanks!

The warning that Sanja shows means there is no more mirror to try and
none hat a canary tile available. But since there are no more mirrors,
CATMAID sticks just to the first it found and attempts to display tiles
regardless.

Bottom line: don't export empty tiles and use an Nginx try_files command
to not get 404s for non-existent empty tiles.

Best,
Tom
>>> *Tile Source Type:* Type 4 (section/scalepower/y_x.ext) (exported from
>>> TrakEM2 using default settings)
>>> *Zoom levels:* 4 (four folders were exported for each section - "0",
>>> "1", "2", & "3" so I'm assuming this equals 4 zoom levels?)
>>> *First tile in zoom level 0 folder*: 3_6.jpg
>>> *Tile size*: 256 x 256
>>> *Number of tiles in zoom level 0 folder: *674
>>>
>>> For the formula Andrew wrote below [3 * 2^(3-1) * 256 = 3072, 0, 0] ---
>>> am I correct in assuming this is *zoom level ** 2^(*x*-1) * *tile-size*
>>> = [*x*, 0, 0]? Would I do this for y as well?
>>>>> <https://groups.google.com/d/msgid/catmaid/d1c58733-8b4b-4977-9c75-ab1d3c80b401%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>
>
>--
>You received this message because you are subscribed to the Google Groups "CATMAID" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to catmaid+u...@googlegroups.com.
>To view this discussion on the web visit https://groups.google.com/d/msgid/catmaid/a2850858-1516-49de-bc68-5be3d07dfb4e%40googlegroups.com.

Marcel Sayre

unread,
Apr 21, 2020, 4:43:31 AM4/21/20
to CATMAID
Hi Tom and Sanja, 

I completely forgot to respond here, just wanted to say thanks to both of you for your help with this question! I determined the correct canary location so we are no longer getting the "Stack mirror..." error and we've now set up the nginx black.jpg block.

Thanks again, cheers,
Marcel

Tom Kazimiers

unread,
Apr 21, 2020, 12:18:00 PM4/21/20
to cat...@googlegroups.com
Hi Marcel,

That's great to hear, thanks for letting us know the suggestions helped!

Best,
Tom
>> email to cat...@googlegroups.com <javascript:>.
>--
>You received this message because you are subscribed to the Google Groups "CATMAID" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to catmaid+u...@googlegroups.com.
>To view this discussion on the web visit https://groups.google.com/d/msgid/catmaid/59ef61b5-d881-4c4b-bfc5-63da995e386a%40googlegroups.com.

Marcel Sayre

unread,
May 30, 2020, 3:06:04 AM5/30/20
to CATMAID
Hey Tom,

I recently started using the local file server (https://github.com/catmaid/CATMAID/tree/master/scripts/data) to trace image data from a custom mirror on my home PC (I'm tracing internationally - relative to our sever - and am trying to speed up the performance a bit on my end). I'm wondering if there's a way to make this script serve a black.jpg in the same fashion that incorporating that block of text you posted above does for our nginx webserver? My instance isn't optimal even with the local mirrors so I'm thinking it might be due to the 404 errors I'm getting for the missing black tiles. My colleague told me the instance from his side of things is working great so I'm thinking it must have something to do with my setup. 

Thanks for your help!
Marcel 

Tom Kazimiers

unread,
May 31, 2020, 10:13:54 AM5/31/20
to cat...@googlegroups.com
Hi Marcel,

Thanks, support for a placeholder image for the server script is indeed
missing. I am currently working on a small update on the local server
script anyway to allow easier downloads of locally cached data from
within the CATMAID UI. I'll make sure to include an option to generate a
placeholder image (or use an existing one) and created an issue for it
here:

https://github.com/catmaid/CATMAID/issues/2009

The 404 errors can indeed mess things up, just like the problems you
have encountered before.

Best,
Tom
>> https://groups.google.com/d/msgid/catmaid/59ef61b5-d881-4c4b-bfc5-63da995e386a%40googlegroups.com.
>>
>>
>>
>
>--
>You received this message because you are subscribed to the Google Groups "CATMAID" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to catmaid+u...@googlegroups.com.
>To view this discussion on the web visit https://groups.google.com/d/msgid/catmaid/be93570c-544a-4329-bfe7-c14f1ceef97d%40googlegroups.com.

Marcel Sayre

unread,
Jun 1, 2020, 5:55:54 AM6/1/20
to CATMAID
Hi Tom,

Great, that would be fantastic. Thanks for that!

Cheers,
Marcel
Reply all
Reply to author
Forward
0 new messages