[GRASS-dev] i.segment: Invalid region id -1

Nikos Alexandris nik at nikosalexandris.net
Thu Dec 5 07:58:14 PST 2013

> > > --%<--
> > > i.segment msx_hpf out=segments_msx_hpf_seeded_t0.02 threshold=0.02
> > > minsize=4 seed=segments_pan_t0.01 memory=3000 iterations=1000
> > > -->%--
> > > It worked in one case (repeated to be sure) and it failed in another!

> > Different computational regions?

> Absolutely.  Two different, independent trials. Same Location, different
> Mapsets, different regions ("physically", if I may say so, and
> computationally).

> > > In the failing case, before the ERROR message, there are multiple
> > > WARNINGS issued:
> > > WARNING: Region consists of only one cell, nothing to update

> > This should not happen, a bug in the region growing algorithm.

Is a Warning message always a bug (in the case of i.segment)?

> > > I went after looking all of the details of the involved maps.  The only
> > > "strange" thing I can see (which I caused) is that the region is 0.6,
> > > the seed (segments_pan_t0.01) is also 0.6 while the group of Pan-
> > > Sharpened images are (each) of 0.60017817 (ns) x 0.60016801 (we)
> > > resolution.  Is this my mistake? The resolution(s) should be identical,
> > > right?

> > Yes. I guess in the process of pansharpening, the region was set to
> > 0.6, then the resolution was adjusted to the extents (for g.region,
> > extents have precedence over resolution).

-- useful --
> > The correct way of adjusting the region would be to either set the region
> > to the pan band or align the region to the band band (g.region align=pan).
-- useful --

> > Note that g.region res=0.6 -a can introduce a pixel shift.
> > Can you reproduce that with sample data?

> I'll try.

I can't reproduce this anymore (with my working images) after being careful 
with extent and resolution. Two examples, both worked fine:

1) Seed map (Pan), HPF-Sharpened MSes and Region: all of 0.59998996
2) Seed map (Pan), group of HPF-Sharpened MSes and Region: all of 0.60017817 x 

However, in a completely different setup (Location, Mapsets), I can see 
multiple Warnings, like above, no error though. The process completes fine and 
I get to see the segments.  Is this ok?

If not, could it be related with sub-sequent processing errors? For example, 
like invalid classification signatures from i.cluster and failure of i.maxlik?  
I use(d) fancy segments-stats (segments used as a cover, group of Multi-
Spectral images used as source for stats) like skewness, kurtosis, etc.


More information about the grass-dev mailing list