NullPointerException when extract GLCM from a tif file

Hi everyone,

I want to extract GLCM feature of a tif file using SNAP. But it returns a NullPointerException. Has anyone had the same problem? It would be great if someone share a solution. Thanks!

The exception log is shown as below.

org.esa.snap.core.gpf.OperatorException: java.lang.NullPointerException
at org.esa.snap.engine_utilities.gpf.OperatorUtils.catchOperatorException(OperatorUtils.java:432)
at org.esa.snap.raster.gpf.texture.GLCMOp.initialize(GLCMOp.java:211)
at org.esa.snap.core.gpf.internal.OperatorContext.initializeOperator(OperatorContext.java:486)
at org.esa.snap.core.gpf.internal.OperatorContext.getTargetProduct(OperatorContext.java:273)
at org.esa.snap.core.gpf.Operator.getTargetProduct(Operator.java:387)
at org.esa.snap.core.gpf.GPF.createProductNS(GPF.java:318)
at org.esa.snap.core.gpf.GPF.createProduct(GPF.java:293)
at org.esa.snap.core.gpf.GPF.createProduct(GPF.java:272)
at org.esa.snap.graphbuilder.rcp.dialogs.SingleOperatorDialog.createTargetProduct(SingleOperatorDialog.java:175)
[catch] at org.esa.snap.graphbuilder.rcp.dialogs.SingleOperatorDialog.onApply(SingleOperatorDialog.java:291)
at org.esa.snap.ui.AbstractDialog.lambda$initUI$9(AbstractDialog.java:519)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

A screen shot here

Hello jingliang,

I am have not used SNAP for a while and updated recent to SNAP 6.0 I am now having the same issue you describe (NullPointerException error using .tif’s in the GLCM tool). I can’t find a help page that explains the inputs needed, but the GLCM used to work with .tif files. I have used GLCM tool on .tif in SNAP 5.X (or converted to BEAM products first the undertaken GLCM) this is frustrating.

Did you find a work around the the issue you were having?

With the GeoTiffs the bands don’t have a unit. I’ve fixed the problem in GLCM to handle no unit. The fix will be available in the next update. For now you could right click on the band and type in anything for the unit.

After I collocated RISAT geotiff file for HH and HV band and performed GLCM. I got the results where there are such variation in bands. Can you provide any solution for this.

can you please check if these patterns already existed before the texture derivation?
Is is possible that they could not be seen clearly, but were enhanced by the GLCM operator. Maybe the resampling of the collocation could be changed to nearest neighbor?

@ABraun thank you for the reply. I checked the original geo tiff file, it doesn’t has any patterns like this. Even if I do GLCM on single band even before collocate I still get such pattern. Also while doing collocate I was doing it with nearest neighbor itself.

can you please try to use coregistration instead of collocation?

@ABraun The RISAT geo tiff files are very heavy so when I try coregistration, it doesn’t process it and the snap software becomes nonresponsive.

If both images are already terrain corrected, you can use less GCPs and “Product Geolocaction” instead of “Orbit” as initial offset method. Both should speed up the processing.

Or even easier: Radar > Coregistration > Stack Tools > Create Stack

make sure that nearest neighbor resampling is selected.

The coregistration goes smoothly as you suggested but then again when I perform GLCM I get the same patterns.

which of the products is affected? Master image, slave or both?

Actually both