Operator exception error when running k means cluster

Hi while running the k means cluster analysis on the subset image of sentinel 2 i’m getting this error.

java.lang.IllegalArgumentException: The specified region, if not null, must intersect with the image`s bounds.
at javax.media.jai.PlanarImage.getData(PlanarImage.java:2069)
at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)
at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:407)
at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:393)
at org.esa.snap.core.gpf.Operator.getSourceTile(Operator.java:461)
at org.esa.snap.cluster.KMeansClusterOp.createPixelIter(KMeansClusterOp.java:257)
at org.esa.snap.cluster.KMeansClusterOp.getClusterSet(KMeansClusterOp.java:197)
at org.esa.snap.cluster.KMeansClusterOp.computeTile(KMeansClusterOp.java:152)
at org.esa.snap.core.gpf.internal.OperatorImage.computeRect(OperatorImage.java:80)
at javax.media.jai.SourcelessOpImage.computeTile(SourcelessOpImage.java:137)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at javax.media.jai.PlanarImage.getData(PlanarImage.java:2085)
at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)
at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:407)
at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:393)
at org.esa.snap.core.gpf.internal.OperatorImage.computeRect(OperatorImage.java:73)
at javax.media.jai.SourcelessOpImage.computeTile(SourcelessOpImage.java:137)
[catch] at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at com.sun.media.jai.util.RequestJob.compute(SunTileScheduler.java:247)
at com.sun.media.jai.util.WorkerThread.run(SunTileScheduler.java:468)

Did you check up this thread or the other related to k means cluster,

Source of thread

@falahfakhri yes i have checked with the thread…can’t find anything related to this error

Does your image subset open correctly all bands?

It seems that the KMeans cluster operator can not fully handle products with bands of multiple resolutions. Only if you select the bands of the highest resolution contained in the product.
I’ve noted this in our bug tracker: SNAP-1171

Please also note that the subsetting has currently also an issue when cropping multi-resolution products.
I guess you can see that your subset product and the original product have the same extent on the world view. For this, a fix will be released probably tomorrow.

So you first need to resample the data to a common resolution and afterwards you can do the subset. And on this subset, the KMeans should work.

@marpet thank you…so first i resample the image to a common reference band/pixel and then subset the image and applied the cluster and it worked…

1 Like

@falahfakhri yeah it opened… thank you