Sar files in Java 8

is there any tutorial or documentation related to SAR files opening using Java8?
Is it possible to use a ProductIO in order to do that and add its content in a JFrame or JPanel ?
I am sorry for any inconvenience, but I am newbie here.

Thanks in advance.

Why do you want to do this on your own when SNAP can do it already?
But you can have a look at the SNAP implementation as an example.
See ProductSceneImage and ProductSceneView

Thank you so much for your response.

I see that ProductSceneView is a subclass of JPanel.
So, Do I need ProductSceneImage to open and present an Sar Image or I can accomplish that using ProductSceneView only?

I do not know the workflow related to this process. So it turns a bit complex to understand.
Could you please provide further details ?

Thank you in advance.

You don’t need just those classes you will need the whole SNAP implementation, or at least a big part of it.
I can’t explain this in a few sentences.

Maybe you tell a bit more about your use case.
Still, why implementing this again, when you can simply use SNAP to display the data?

I am developing a tool for academic research purposes. I am a grad student.
So, this tool is supposed to open SAR files and enable some processing algorithms related to Computer Vision.

Could you please help me?

ProductSceneImage is necessary because it is an parameter of the constructor.
With some changes it is probably possible to add the ProductSceneView to a JFrame or something similar. We did this in BEAM.
But maybe you don’t try to do everything from scratch.
SNAP can already read SAR products and can be extended with processing algorithms (Operators). Also if the specific SAR product can’t be read, a new reader can be implemented.
Maybe you have a look at the Development Guide.
We will be happy to help you with this, but to help you with doing everything from scratch probably exceeds our support capabilities.

Thank you for your response.

We will be happy to help you with this, but to help you with doing everything from scratch probably exceeds our support capabilities.

Sorry for any inconvenience, but could you please help me with a piece of information?
After loading a product using “reader.readProductNodes(selectedFile, null);”…which steps I should follow in order to build a ProductSceneImage?

Thank you in advance.
Sorry for any inconvenience once again.

All this is implemented in the OpenImageViewAction.
The method openProductSceneView creates and opens the ProductSceneView. The creation of the ProductSceneImage is implemented in createProductSceneImage

For RGB images you can have a look at OpenRGBImageViewAction. Check the methods openProductSceneViewRGB and createProductSceneImageRGB

Basically you just need to call the constructor like this.

...
Product product = reader.readProductNodes(selectedFile, null);
RasterDataNode raster = product.getBand("TheBandName");
PropertyMap config = SnapApp.getDefault().getPreferencesPropertyMap();
ProductSceneImage sceneImage = new ProductSceneImage(raster, config, ProgressMonitor.NULL)
...

Thank you so much for your reply. Thanks to you I think I am closer to accomplish my goal.

I am trying to open a Sentinel 1 file through .zip or manifest.safe. Both are leading me to the same error when I call reader.readProductNodes(file, null); - code snippet below:

	Product product = null;
    readerPlugin = new Sentinel1ProductReaderPlugIn();
    reader = readerPlugin.createReaderInstance();
    
    if(!file.exists()) {
    	String err = ("File not found!");
    	errors.append(err);
        return;
    }

    final DecodeQualification canRead = readerPlugin.getDecodeQualification(file);
    if (canRead != DecodeQualification.INTENDED)
    	errors.append("Problem opening file!!");

    try {
        product = reader.readProductNodes(file, null); **<= Exception here**
        if (product == null)
        	errors.append("Problem opening file!!");

SEVERE: …sentinel1.Sentinel1Level1Directory: measurement/s1a-iw-grd-vv-20150325t140755-20150325t140813-005189-0068c0-001.tiff not found
SEVERE: …SARReader: br.com.sarsea.sentinel1.Sentinel1ProductReader
[input=/home/…/…/filename/manifest.safe]:

TIFF not found, but the file is located in:
/home/…/…/filename/filename.SAFE/measurement

I have noticed that after unpacking the image filename.zip it was generated a subdirectory named filename.SAFE.

Yes the caso2_ breaks the naming convention.

In general reading a file is much simpler as your code.
All you need to do is

Product s1Product = ProductIO.readProduct(file)

This should give you the product.

Thank you so much for your help so far.

I was facing an issue related to PropertyMap and Preferences:
PropertyMap config = SnapApp.getDefault().getPreferencesPropertyMap(); **<= HERE
sceneImage = new ProductSceneImage(raster, config, ProgressMonitor.NULL);

But now…
Mission Accomplished

Thanks
Best regards

As a Java layman,I‘m tending to find a method to directly read the sentinel-1 compressed file(.zip) with matlab. Once I noticed that SNAP can directly read the .zip file ,So I came to here try to find some valuable information. After reading the discussions between you and marpet, It seems can solve my problem, But I don’t know How to apply this code,can you give me some practical advises?
Thank you in advance.

Actually, all you need is marpet’s line:

Product s1Product = ProductIO.readProduct(file)

The dependencies you need for this are snap-core and s1tbx-io .

If I’m going to use this function, do I need download all the source code ?I even don’t know how to use the github source code.Where I should start first? Using this Website?
https://senbox.atlassian.net/wiki/spaces/SNAP/pages/8847381/Developer+Guide
I know nothing about Java. *I am confused now

The developer guide is a good starting point. You can checkout snap-engine (https://github.com/senbox-org/snap-engine) and the s1tbx (https://github.com/senbox-org/s1tbx) following the instructions given in the readme or here.

Or would you rather use Python? I think it might be the better option for you.