Read IW SLC files into Matlab?

I have not analysed any S1 IW SLC tiff measurement that didn’t have the actual pixel data immediately after the tiff header in one single block, ie all the images I have looked at (not many) had the following structure: tiff header, followed by the whole pixel data in one single block, followed by the tiff tags. This structure is easily read in binary format (fread in Matlab) and then interpreted following the instructions in Section 6.2.1 of ‘Sentinel-1 Product Specification’ document (and tiff references cited in it).

A couple of caveats:

  • I believe the tiff standard allows for flexible file structures in which the image data can be placed anywhere (ie it has to go behind the header, but not necessarily immediately behind it). Hopefully the S1 tiff writer will not change in the future
  • the header has different size depending on whether it is a normal Tiff or BigTiff. There is a field in the header that indicates which type of Tiff the file is

I am sorry that I tried your approach, but it did not work. In Matlab, the error information says that the input’s type is char which is not supported by multibandread() function. How can I fix this?

It’s impossible to help with so little to go on. You need to post the exact code you used and the error message you received.

Just a couple quick notes: data type of 2 is actually signed 16 bit integer, not 32 bit floating point number.

Also, the 4th argument for multibandread should be 0 without the quotes, or else it won’t work.

Hi Nuno Miranda! I tried to read geotiff S1 with IDL and I obtained an array of integers. I dont understand how I could separate i/q to reconstruct a complex float array if the data array dimesions are the same. Thak’s
Sebastian

There is a tutorial on SAR EDU for DEM generation of SLC SAR data with matlab.
I don’t know if it helps your question but at least there is also data imported.
https://saredu.dlr.de/unit/dem_matlab

@sbstbalbarani
the approach below might not be the most efficient/elegant one but it allows to use IDL geotiff reader

  maskI=ulong('11111111111111110000000000000000'b)
  maskQ=ulong('00000000000000001111111111111111'b)
  r = query_tiff(path_to_S1_geotiff, tiffInfo, geotiff=tiffHead)
 
  ;sub_rect is used to read just a portion of the data
  block = read_tiff(path_to_S1_geotiff, sub_rect=sub_rect)

  ; if the image is SLC then we need to create  complex buffer
 if (tiffinfo.pixel_Type eq 13) then begin
    blockI = fix(block and maskQ)
    blockQ = fix(ishft( (block and maskI), -16))
    block = complex(blockI, blockQ)
  endif

Thanks nuno! I tried to read sentinel-1 geotiff located in measurement directory of SAFE structure with IDL language, but I couldnt. In your code r = query_tiff(… does not recognize the tiff. It is correct? sbst

Hi ABraun,

I implemented the following example using matlab and it worked very nice, but how we could change the parameters of ENVISAT or ERS to the Sentinel-1 specially the burst issues?, SAR-EDU_Tutorial_Focusing_Matlab.pdf (626.0 KB)

unfortunately, I’m not experienced with Matlab, but you could try writing Dr. Stefan Auer as he is quite responsive to SAR related questions.

Hi every body
I have a question
I make a DEM and now, I want to know how i can bring DEM information into matlab?
I want it was like a picture and have elevation value in each pixel!

and another question what is the best way for reading the slc image in matlab?

maybe one of these is helpful to you

http://de.mathworks.com/help/map/ref/sdtsdemread.html;jsessionid=051a0bfb04e4ae55ff963fcb3ca3
https://de.mathworks.com/help/map/ref/geotiffread.html


https://saredu.dlr.de/unit/dem_matlab
https://saredu.dlr.de/unit/focussing_matlab

Thank you so much:slight_smile:

I create ENVI export from my DEM and load hdr file in matlab and read it
but there are some mistake in my read matrix !
when I do terrain correction on my DEM , it is not a complete square image and have black area in border
when I read it in matlab these area have negative values!!
I don’t know how to correct them!

black borders could occur when the DEM used for terrain correction doesn’t fully cover the whole product.
Later on, have a look at the nodata value under the raster’s properties.

I can’t get what you mean!Can you explain more?!Tank you

From: Andreas BraunSent: Monday, December 5, 2016 17:43To: ftp.tarighat@gmail.comReply To: STEP ForumSubject: [step] [s1tbx] Read IW SLC files into Matlab?

ABraun

December 5

black borders could occur when the DEM used for terrain correction doesn't fully cover the whole product.

Later on, have a look at the nodata value under the raster’s properties.


Visit Topic or reply to this email to respond.


In Reply To

FTP

December 5I create ENVI export from my DEM and load hdr file in matlab and read it but there are some mistake in my read matrix ! when I do terrain correction on my DEM , it is not a complete square image and have black area in border when I read it in matlab these area have negative values!! I don’t know ho…


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

values at your border could be due to nodata values or some kind of resampling.
Are the negative values consistent or varying along the border?

I never worked with Matlab so I can’t help you with the format the product should have when importing it.

Yes these are

When I export the DEM in ENVI this problem appears againFrom: Andreas BraunSent: Monday, December 5, 2016 23:36To: ftp.tarighat@gmail.comReply To: STEP ForumSubject: [step] [s1tbx] Read IW SLC files into Matlab?

ABraun

December 5

values at your border could be due to nodata values or some kind of resampling.

Are the negative values consistent or varying along the border?

I never worked with Matlab so I can't help you with the format the product should have when importing it.


Visit Topic or reply to this email to respond.


In Reply To

FTP

December 5I can’t get what you mean!Can you explain more?!Tank you

[ABraun]#006699;; font-size:13px;font-family:‘lucida grande’,tahoma,verdana,arial,s…


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

yes all of the black border have negative varying values

Hi Luke, I tried your approach and worked, I read the SLC image on Matlab. However what I am interested in is to get the IQ data and the matrix data doesn’t seem to have any complex numbers. I am interested in working with the raw data.
Can you advise me how to do that?

Thanks!