Home Image-Pro General Discussions

Fiber app and segmentation

Is it possible to use Fiber app and segmentation tool at the same time? Before I separate objects in Fiber app, I already want to exclude some objects on the picture with segmentation tool (I only want to analyze dark objects in the app)?

Best Answer

  • Answer ✓
    Hi Ana,

    The following post describes where to find coding documentation and samples: http://forums.mediacy.com/discussion/comment/1912/#Comment_1912 

    Regarding your specific question: you can insert LoopOnSeparateFibers macro into any active project. For example Project1, which is active by default. Or you can create your own new project and add that macro there.



  • Hi Sana,

    Yes, you can exclude the objects you don't need, create mask of only valid objects in Count/Size and run Fiber separation on that mask. Note that you will have to set Image Type to "Binary image" in the app.


  • Sana --

    I do not have much experience with the FIBERS APP.

    I took your question as an opportunity to play with it and play with PREMIER 9.2.

    Below, please find a SCREEN CAPTURE that illustrates the concept that YURI described.

    In the images that include "DISPLAY" in the title, I adjusted the DISPLAY BRIGHTNESS to 0 so that the MEASUREMENT LINES generated by the FIBER APP would be more visible.

    I hope this information helps.

    -- Matt

  • Thank you both, for your previous help. Using mask works with some things, but I'm wondering if there is any other way to exclude background from the picture. 

    Right now I'm using FiberApp for thickness mesaurements. If I create a mask to exclude background, I'm not sure that the thickness mesaurement is realistic. Mask that appears after using dark/manual segmentation obviously depends on my decision where are the boundaries of an object, so I have problems how to standardise the procedure.

    I can do the mesaurements by clicking on the specific objects, but with a bunch of pictures there is just to much of handwork. I want to automatise a procedure a little bit more.

    I'm sending you an example of a picture I need to analyze. I want to know the thickness of DARK BLUE curves, without purple ones and without background. Pictures are really complex, so I would be really glad for any help I can get.

    Thank you in advance! 


  • Sana --

    Based on your message, it seems that you would like to know the THICKNESS of the DARK BLUE CURVES with as little USER INTERACTION as possible.

    I believe a step in the right direction might be the DISTANCE MAP FILTER.

    In the FIRST IMAGE below . . .


    4 LINE PROFILES have been generated in each TILE.  The "tails" of the LINE PROFILES were set so the "business" portions of the PROFILES would not overlap (1 shortest, 4 longest).

    In the UPPER HALF of the IMAGE, you see a section of your sample.  In the LOWER HALF of the IMAGE you see a zoomed in section of the sample with LINE 01.

    Please see that:

    ** The WIDTH of your BLUE CURVES are shown by the WIDTH of the PROFILE PEAKS in the LEFT TILES.
    ** The WIDTH of your BLUE CURVES are shown as the HEIGHT of the PROFILE PEAKS in the RIGHT TILES.

    In the SECOND IMAGE below . . .

    A portion of the DISTANCE MAP image has been PSEUDO COLORED as show.  This COLOR CODES the THICKNESS of the OBJECT.

    I hope this information is helpful.

    -- Matt


  • Hi Matt,

    first thank you for your quick response and your help.

    I'm not sure if I completely understand Line profile tool. So with this tool, I should draw few lines through the object where I want to mesaure thickness. Ok, but I still get just the information about the thickness of a specific line/curve from the picture. I would like to know the thickness of ALL the lines/curves in one picture, so that I can calculate average at the end. Is this possible with Line profile tool? I also want to know how to collect the data from this mesaurements? For example that the thickness is 5 mm and not in the form 2-7 mm. It would be easier to process the data in the end.

    Pseudo colored image shows just the layout of thickness throught the image and you can't really mesaure thickness from that, if I understand right?

    Nevertheless, you gave me some ideas how to analyze the pictures. I managed to get rid of most of the background, just by using Smart Segmentation Mask and with "Create an Image" tool. Than I used FiberApp and it worked quite ok.


  • edited August 2016
    Hi Ana,

    To illustrate the process of measuring average thickness using distance map I have created a macro project (attached) that will measure thickness of objects. The active image should be a calibrated binary image of the objects to measure thickness (test image is also attached).
    The process includes the following steps:
    1. Duplicate image
    2. Create distance map of one copy
    3. Skeleton of another copy.
    4. Merge Skeleton and Distance map, so the new image will look like skeleton with intensities corresponded to the thickness of the object at that point (skeleton passes through the ridge of the distance map with maximum intensity values).
    5. Apply intensity calibration that corresponds to spatially calibrated thickness.
    6. Measure intensity parameters (mean, max,min) that will give the thickness measurements. E.g. Intensity (mean) will give average object thickness in calibrated units.
    That's illustrated on the screenshot as measurement labels:

    Optional ColorizeThickness macro can be used to colorize distance map according to thickness.



  • Yuri --

    Thank you for wiring up that EXAMPLE IMAGE and EXAMPLE PROJECT to illustrate this concept.

    That is exactly the approach that I was thinking of.

    This should be a big helping hand for ANA.

    Thanks again.

    -- Matt

  • Yuri,

    thank you for explaining the concept in details. I tried your macro and it works well. Still I want to repeat the steps by myself and I'm not sure that I understand the intensity calibration completely(point number 5)?

    Still, this is really usefull. A big thanks!


  • Another question.. I was trying to establish macro, which includes fiber separation.

    The problem is that macro stops when it comes to FiberApp. Is it even possible to incorporate FiberApp in my macro?

    Maybe is this possible with batch processing? I tried to add FiberApp to `Batch proccesing - Run after` but there are to many possibilities within Module `Fiber separation` and I'm not really sure which to choose.

    Best regards,


  • Hi Ana,

    I missed your last post, here is a delayed answer:
    The main macro function that does fiber separation is "SeparateFibers", you can call it in the batch processing, but you should also add a call to collect the data to Data Collector, so you have the measurements from all images in a folder. 

    Here is the example of that macro, which you can set as "Loop On":

        Public Function LoopOnSeparateFibers() As SimpleScript
            LoopOnSeparateFibers = New SimpleScript
            Dim image1
            With Automate.ScriptingCommands.PlayMacro(LoopOnSeparateFibers)
                .MacroFile = "FiberSeparation>ModuleFiberSeparation.vb"
                .MacroName = "SeparateFibers"
                .Run(Nothing, Nothing)
            End With
            With Application.DocumentCommands.ActiveImage(LoopOnSeparateFibers)
            End With
            With Measure.Data.CollectorCommands.Collect(LoopOnSeparateFibers)
                .Run(New List({image1}))
            End With
        End Function
    Note, that you have to setup Data Collector yourself selecting the measurements you want to collect and cleaning it up before running the batch. You can do it manually or make another macro that will be set as "Run Before".

    Note, that Fiber separation macro will use current parameters from the app's dialog, so you have to set all of them properly (or load from FSO file) before running the batch.


  • Hi,

    are there maybe some tutorials or guidlines for working in "code mode"?

    I have been working with macros and apps for a while, but I get stuck when it comes to codes. For example I'm not sure where to insert macro from previous post, that I can use it in Batch processing as a loop. I know that this is probably basic stuff, but I am completly new to this and I would need some guidlines.

    Thank you.

    Best regards,

Sign In or Register to comment.