Menu

#19 Feature Request: Brush tool operation outside of bounding box

New
nobody
None
2019-08-02
2019-07-31
Ben Padman
No

The brush tool only operates when the centre of the tool is in the bounding box.
It makes sense to have this constraint because there are no objects to segment outside the image, however, it becomes a problem for features located on the edge of the bounding box.

When the centre of the brush tool reaches the border, the tool continues in the unconstrained direction.
This results in a perfectly straight selection the 1 radius width from the border (see attached image). This becomes very annoying when trying to segment a feature as it leaves the field of view in a stack.

I would like to request that the brush tool be allowed to operate outside of the bounding box, or at least 1 radius unit outside the box.

Ideally, I'd also like to be able to activate the brush selection outside the box, so a selection can be gently dragged into the field of view without having to precisely find the border first. This would greatly improve my workflow.

Thank you.

1 Attachments

Discussion

  • Ilya Belevich

    Ilya Belevich - 2019-07-31

    Hi Ben,
    the clipping of the brush tool occurs in two situations:
    1. when the brush is at the physical edge of the dataset (Pixel Info: has negative values, as in case1.jpg)
    2. when the brush is at the edge of the viewing window(for example when zoomed-in, case2.jpg)

    to make sure that I understand the problem correctly, which of these cases you are referring?

     
    • Ben Padman

      Ben Padman - 2019-08-01

      Thank you Ilya, I am specifically referring to case 1.
      Using the MIB splash screen as an example;
      A 12px radius brush located at (1;256) should select a 226px^2 area region that extends 12px from the image border; and it does (first attached image).
      A 12px radius brush located at (0;256) should select a 202px^2 area region that extends 11px from the image border; but it does not, because the tool cannot activate (second attached image).

      Also, I noticed some very unusual behaviour in the coordinate display while acquiring those screen shots. Compare the coordinates of the cursor in the two attached images; translating the cursor one unit (-1;0) from (1;256) displayed (0;289) instead of (0;256). I assure you that I did not move the cursor 33 pixels.

      Similar coordinate discrepancies occur when the cursor crosses the other physical borders, and the varies depending on the size of the image. Does the region surrounding the image data have its own coordinate system independently of the image coordinate system? I could see how that might complicate my feature request.

      (p.s. I actually consider “case 2” to be a feature; it prevents the accidental selection of objects that are not currently visible)

       
  • Ilya Belevich

    Ilya Belevich - 2019-08-01

    thank you for clarification.

    I am specifically referring to case 1.
    by default it is not possible. The reason is that the model takes the same physical size (in pixels) as the underlying data image, having models of different from the image size is technically possible, but it requires additional logic. Also, normally we can't model the structures that we can't see.
    There is, however, a solution to that problem. What you need to do is to extend the width/height of your dataset to the desired value. There are two tools available for that:
    1. Menu->Dataset->Transform->Add frame->provide new height/width -> allow you to pad the dataset with a frame to the desired width/height.
    2. Menu->Dataset->Transform->Add frame->provide dX/dY -> allow you to enter a value that will be used to pad the dataset from the sides.
    As result you will get an empty frame that you will be paint over with the brush.
    So load the dataset, load the existing model and add frame to the dataset. Save both new dataset and the model for future work.

    Also, I noticed some very unusual behaviour in the coordinate display
    yes it is not a bag - it is a feature :]. You are correct, the display area that is not occupied with the image has its own coordinate system that matches the one of the image only at 100% magnification. When the cursor above the image, it shows the image coordinates under the cursor and also image intensity at the corresponding point. When the cursor is away from the image the displayed coordinates are not really useful, perhaps I should change them to some "out of boundaries" text... In addition, the color intensity is not displayed but replaced with (RRR:GGG:BBB) text.

    Case 2: I must admit it bugs me slightly also, but there is a technical reason why the brush is clipped. To improve performance, MIB renders always renders only the part of the dataset that you currently see on the screen. As result. when the brush gets to the edge of the shown dataset it gets clipped. To fix this, I would have to rewrite the rendering part and render image that is ~1/4 larger in height/width than the shown area. This unfortunately will drop performance with large rasters.

     
    • Ben Padman

      Ben Padman - 2019-08-01

      Thank you for the workaround Ilya.
      I should clarify further though; I do not need a model to be larger than the image and I actually need to avoid that.

      I am segmenting correlative data (confocal + FIBSEM) and I am constantly switching modalities. Everything has already been aligned to a coordinate system, so I'm trying to avoid adjustments to image coordinates. All I'd like to do is select features inside the image, without the centre of the brush tool being within the image.

      I like the dX/dY method, but I have a few more questions:
      Will the new boundary dimensions apply when I reload a model? or do I need to re-load the image, add a frame with dX/dY, then load the model?
      Is there an easy way to define the image boundary geometry separately from the exported mask geometry (i.e. allow image selections within {0,512;0,512}. [i.e. Image size after adding dX/dY] but only export {64,448;64,448} [i.e. the original image boundaries before adding dX/dY])?

      It would probably be easier for me to add a pre-defined border to all my data before loading it into MIB, but then I wont be able to use some of the thresholding features in MIB.

       
  • Ilya Belevich

    Ilya Belevich - 2019-08-02

    All I'd like to do is select features inside the image, without the centre of the brush tool being within the image.

    ok, now I finally got the point. I need to check how easy it can be done, but I agree, it it nice thing to have.

    Will the new boundary dimensions apply when I reload a model? or do I need to re-load the image, add a frame with dX/dY, then load the model?

    The only requirement is that physical sizes (width/height/depth) of the image dataset and models should match. When you add frame, both image and model are increased by the size of the frame. If you save them both after that, both of the files will be larger. Perhaps, when you finish the model you can crop the dataset with loaded model to restore original dimensions (Dataset->Crop dataset).

    (i.e. allow image selections within {0,512;0,512}. [i.e. Image size after adding dX/dY] but only export {64,448;64,448}

    not with default tools, the export/save work only for the full dataset. The crop of the dataset back to the original dimensions is the only way. Or use scripting if you have MIB under Matlab environment. The current beta of MIB is focused on implementation of the batching, when used many opetations can be automatically repeated. For example, it is possible to have the crop operation as the batch action, which may make restoration of the dataset to the original size much easier.

    I also noticed that I should add to the add frame possibility to use negative values, in this case the added frame can be easily removed by using the same tool with the negative values.

    It would probably be easier for me to add a pre-defined border to all my data before loading it into MIB, but then I wont be able to use some of the thresholding features in MIB

    yes, there may be some problems due to that. The idea is to make the border with the color of your background. In this case thresholding techniques won't take it. Or not consider those areas at all, because you can remove them at the end using the crop.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.