Hi!

Quite a basic question but it is bugging me :D

I have a set of objects in a shapefile. I use them to generate object features and now I need to calculate the MEDIAN value for each of those objects for all layers (40) and export it as a CSV table with the calculated values. 

Any ideas?

Best, 

Ivan

P.S. is there an automated naming fuction for layer names based on the name of the file being loaded? Spent quite some time to name all 40 layers :D

 

11 comments

  • Christian Weise

    Hello Ivan,

    You can define the name of the loaded file as layer aliases using the "{scene}" block as alias in the Customized Import routine. The default search string "{{root}\{any-folders}\{scene}.tif:reverse}" should work (you can change the format from tif, of course). Using customized imports is not so complicated as it looks like at the beginning. (ツ)

    Please note, the median is equivalent to quantile 50.

    With the 'export object statistics' algorithm you can generate a CSV table with the quantile50/median values per objects from the object domain of the process.

    Cheers

    Christian

  • Ivan Tomljenović

    Great!

    Thank you very much! :)
    If I could add one idea from the user perspective, it would be great if one could do a multiple layer selection when calculating these values. I had to click quantile (50) 40 times and select one layer by one. Maybe there is a workaround but just an idea :)
    Once more: THANK YOU! :)

    Ivan

  • Christian Weise

    There is a workaround/solution using the 'create for all layers' option in the context menu of the right mouse button:

    Median/Quantile50 is the default value, means your will save definitely time using this way to generate the features.

    Cheers

    Christian

  • Ivan Tomljenović

    Oh! Was not even aware of the right-click feature! My bad. :)

    One final question, on top of the median I wanted to add to the statistics file a final note of the ID attribute from the shapefile that I used to generate the segmentation for the areas of interest. I went to the feature selection and added vector features - attributes - generated vector object attribute for the column ID and after running the whole export object statistics algorithm I got all the quantile values for each layer but the last column for the ID was left as "undefined" for each value in the cell. Double-checked my shapefile and it only has one attribute and that is the ID.


    Ivan

  • Christian Weise

    Wow, congratulation: you found a bug (⊙_☉)!!! ... I can reproduce the issue ... PLEASE create a support ticket (https://support.ecognition.com/hc/en-us/requests/new).

    But eCognition offers (always) a workaround: Please convert the vector features into object variables and add the object variables to your export statistics (this works fine on my computer). To do so, please use 'update variable' algorithm where you have to define a object variable name (string or double) "ValueFromShapefile01" and the needed feature from the shapefile, after executing the object variable contains the shapefile attribute and you can export it.

  • Ivan Tomljenović

    Ok, made it! :)

    Another one I noticed now. When I choose the export vector layer (to generate a shapefile with all the selected features as attributes) and I go and select all the quantiles for the layers plus the variable and click ok, the whole eCognition stops responding and I can't continue with shapefile export option selection and execution of the algorithm.

    Best,
    Ivan

  • Matthias Staengel

    Hi Ivan,
    Let me also join this party!
    After selecting the attributes, a second window pops-up that you need to confirm with "OK". Maybe this window is somewhere on another screen in your case? If you are not closing this window eCognition seems to be "frozen".


    Cheers,
    Matthias

  • Ivan Tomljenović

    Hey! Yes, I click ok and then the whole ECOG goes dark and my mouse starts spinning and it is stuck like this for the past 30 mins :D
    If I click anywhere on the field I get the "program is not responding, should you wait or break it" message :)

     

  • Matthias Staengel

    For the first issue, that it exported "undefined" was actually correct ;). Instead of using the vector feature you will need to use the object feature:

  • Christian Weise

    After an exchange of ideas with support, I realize that it was not a bug after all: object statistics can only be exported via object features - vector features are not supported here. To make it short: with the object variables you have solved the problem.

  • Christian Weise

    But please work with the Support to reproduce the crash (>_<).

Recent Discussions

Need more help?

Enter Knowledge Base Contact Support