[GRASS-dev] [GRASS GIS] #2856: i.segment: warning "Region consists of only one cell, nothing to update" slows down module

#2856: i.segment: warning "Region consists of only one cell, nothing to update"
slows down module
------------------------------+-------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.4
Component: Imagery | Version: svn-trunk
Keywords: i.segment region | CPU: Unspecified
Platform: Unspecified |
------------------------------+-------------------------
In the NC dataset:

{{{
g.region n=221318 s=220073 w=637746 e=639646 res=1
i.group ortho in=ortho_2001_t792_1m
i.segment group=ortho@user1 output=ortho_seg_001 threshold=0.01
memory=2500
}}}

Then, when I try to use the output of this as seeds for the next level:

{{{
i.segment group=ortho@user1 output=ortho_seg_002_seeded threshold=0.02
seed=ortho_seg_001 memory=2500
}}}

I get tons of

{{{
WARNING: Region consists of only one cell, nothing to update
}}}

The module run takes +/- 1m25.

When I comment
[https://trac.osgeo.org/grass/browser/grass/trunk/imagery/i.segment/create_isegs.c#L1086
line 1086] in imagery/i.segment/create_isegs.c so that the warning is not
issued, module run only takes about 20s.

Is this warning really necessary ? Or is it a bug that it appears in this
context ?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2856&gt;
GRASS GIS <https://grass.osgeo.org>

#2856: i.segment: warning "Region consists of only one cell, nothing to update"
slows down module
--------------------------+------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.4
Component: Imagery | Version: svn-trunk
Resolution: | Keywords: i.segment region
       CPU: Unspecified | Platform: Unspecified
--------------------------+------------------------------

Comment (by neteler):

Replying to [ticket:2856 mlennert]:
> Is this warning really necessary ?

What about changing it to G_verbose_message()?

> Or is it a bug that it appears in this context ?

Unfortunately I don't know, maybe the main authors?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2856#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#2856: i.segment: warning "Region consists of only one cell, nothing to update"
slows down module
--------------------------+------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.4
Component: Imagery | Version: svn-trunk
Resolution: | Keywords: i.segment region
       CPU: Unspecified | Platform: Unspecified
--------------------------+------------------------------

Comment (by mmetz):

Replying to [ticket:2856 mlennert]:
> In the NC dataset:
>
>
> {{{
> g.region n=221318 s=220073 w=637746 e=639646 res=1
> i.group ortho in=ortho_2001_t792_1m
> i.segment group=ortho@user1 output=ortho_seg_001 threshold=0.01
memory=2500
> }}}
>
> Then, when I try to use the output of this as seeds for the next level:
>
>
> {{{
> i.segment group=ortho@user1 output=ortho_seg_002_seeded threshold=0.02
seed=ortho_seg_001 memory=2500
> }}}
>
> I get tons of
>
> {{{
> WARNING: Region consists of only one cell, nothing to update
> }}}
>
> The module run takes +/- 1m25.
>
> When I comment
[https://trac.osgeo.org/grass/browser/grass/trunk/imagery/i.segment/create_isegs.c#L1086
line 1086] in imagery/i.segment/create_isegs.c so that the warning is not
issued, module run only takes about 20s.
>
> Is this warning really necessary ? Or is it a bug that it appears in
this context ?

It is a bug that appears in this context. The warning is justified because
it appears only when regions are merged. A merged region must always
consist of more than one cell (merge of two original regions each
consisting of at least one cell). The bug seems to be an inappropriate
call to merge_regions().

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2856#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#2856: i.segment: warning "Region consists of only one cell, nothing to update"
slows down module
--------------------------+------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.4
Component: Imagery | Version: svn-trunk
Resolution: | Keywords: i.segment region
       CPU: Unspecified | Platform: Unspecified
--------------------------+------------------------------

Comment (by mmetz):

Replying to [comment:2 mmetz]:
> Replying to [ticket:2856 mlennert]:
> > In the NC dataset:
> >
> >
> > {{{
> > g.region n=221318 s=220073 w=637746 e=639646 res=1
> > i.group ortho in=ortho_2001_t792_1m
> > i.segment group=ortho@user1 output=ortho_seg_001 threshold=0.01
memory=2500
> > }}}
> >
> > Then, when I try to use the output of this as seeds for the next
level:
> >
> >
> > {{{
> > i.segment group=ortho@user1 output=ortho_seg_002_seeded threshold=0.02
seed=ortho_seg_001 memory=2500
> > }}}
> >
> > I get tons of
> >
> > {{{
> > WARNING: Region consists of only one cell, nothing to update
> > }}}
> >
> > The module run takes +/- 1m25.
> >
> > When I comment
[https://trac.osgeo.org/grass/browser/grass/trunk/imagery/i.segment/create_isegs.c#L1086
line 1086] in imagery/i.segment/create_isegs.c so that the warning is not
issued, module run only takes about 20s.
> >
> > Is this warning really necessary ? Or is it a bug that it appears in
this context ?
>
> It is a bug that appears in this context. The warning is justified
because it appears only when regions are merged. A merged region must
always consist of more than one cell (merge of two original regions each
consisting of at least one cell). The bug seems to be an inappropriate
call to merge_regions().

No, an inappropriate call to update_band_vals(). Fixed in r67915,6 (trunk,
relbr70).

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2856#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#2856: i.segment: warning "Region consists of only one cell, nothing to update"
slows down module
--------------------------+------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.4
Component: Imagery | Version: svn-trunk
Resolution: fixed | Keywords: i.segment region
       CPU: Unspecified | Platform: Unspecified
--------------------------+------------------------------
Changes (by mlennert):

* status: new => closed
* resolution: => fixed

Comment:

Replying to [comment:3 mmetz]:
> Replying to [comment:2 mmetz]:
> > Replying to [ticket:2856 mlennert]:
> > > In the NC dataset:
> > >
> > >
> > > {{{
> > > g.region n=221318 s=220073 w=637746 e=639646 res=1
> > > i.group ortho in=ortho_2001_t792_1m
> > > i.segment group=ortho@user1 output=ortho_seg_001 threshold=0.01
memory=2500
> > > }}}
> > >
> > > Then, when I try to use the output of this as seeds for the next
level:
> > >
> > >
> > > {{{
> > > i.segment group=ortho@user1 output=ortho_seg_002_seeded
threshold=0.02 seed=ortho_seg_001 memory=2500
> > > }}}
> > >
> > > I get tons of
> > >
> > > {{{
> > > WARNING: Region consists of only one cell, nothing to update
> > > }}}
> > >
> > > The module run takes +/- 1m25.
> > >
> > > When I comment
[https://trac.osgeo.org/grass/browser/grass/trunk/imagery/i.segment/create_isegs.c#L1086
line 1086] in imagery/i.segment/create_isegs.c so that the warning is not
issued, module run only takes about 20s.
> > >
> > > Is this warning really necessary ? Or is it a bug that it appears in
this context ?
> >
> > It is a bug that appears in this context. The warning is justified
because it appears only when regions are merged. A merged region must
always consist of more than one cell (merge of two original regions each
consisting of at least one cell). The bug seems to be an inappropriate
call to merge_regions().
>
> No, an inappropriate call to update_band_vals(). Fixed in r67915,6
(trunk, relbr70).

Great. It works great for me. Thanks for the fix.

Closing.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2856#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>