X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 22 Aug 2023 09:07 PM by  Andrew Cool
Can any IDL library handle .ser files?
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Eileen Meyer



New Member


Posts:
New Member


--
06 Mar 2023 08:14 AM
    Hi,

    Does anyone know if IDL can import .ser files? It is a video file format produced by the SharpCap astronomy imaging software.

    It's not listed in the file formats list:
    https://www.l3harrisgeospatial.com/docs/file_formats.html

    But I still wanted to double-check before abandoning IDL for python...

    Ben Castellani



    Basic Member


    Posts:130
    Basic Member


    --
    07 Mar 2023 11:17 AM
    There is no included SER reader within IDL, but like any basic data format it can be read into IDL relatively easily as long as the file format specifics are known to the user.

    Using the information provided in the description for SER files (http://www.grischa-hahn.h...SER%20Doc%20V2.pdf), I was able to create a quick reader.

    See the below IDL code example which reads in a monochrome SER file of Jupiter.
    An example SER file used in this example can be found here: https://github.com/cgarry/ser-player/releases/download/v1.4.0/Jup_200415_204534_R_F0001-0300.zip
    NOTE: If you specific file is more complex (contains color data or is big Endian) you would need to adjust this sample code.

    
    
    ;This function is use to convert 4-byte arrays into a single 32-bit integer value
    function byteToInt32, byteArr
      if n_elements(byteArr) eq 4 then begin
        int32 = byteArr[0]+byteArr[1]*2^8+byteArr[2]*2^16+byteArr[3]*2^24
      endif
      return,int32
    end
    
    ;SER file to be read
    file = 'Jup_200415_204534_R_F0001-0300.ser'
    
    ;Open SER file    
    openr, u, file,/GET_LUN
    
    ;Read the header of file which is always 178 bytes
    header = bytarr(178)
    readu, u, header
    
    ;Extract image metadata from header
    imageWidth = byteToInt32(header[26:29])
    imageHeight = byteToInt32(header[30:33])
    frameCount = byteToInt32(header[38:41])
    
    ;Use metadata to read in the raw image data frame-by-frame
    allFrames   = bytarr(imageWidth,imageHeight,frameCount)
    frame = bytarr(imageWidth,imageHeight)
    
    for i=0,frameCount - 1 do begin
      readu, u, frame
      allFrames[*,*,i] = frame
    endfor
    
    FREE_LUN, U
    
    ;Create an animation of the frames
    XINTERANIMATE, SET=[ImageWidth, imageHeight, 100], /SHOWLOAD
    FOR I=0,frameCount-1 DO XINTERANIMATE, FRAME = I, IMAGE = allFrames[*,*,I],/ORDER
    XINTERANIMATE, /KEEP_PIXMAPS
    
    END
    
     

    Andrew Cool



    New Member


    Posts:1
    New Member


    --
    22 Aug 2023 09:07 PM
    Hi,

    Hope I'm not too late. I have an IDL SER player with a cassette player based GUI that you can have if you wish. It was developed for astronomer George Viscome.


    Regards,

    Andrew Cool
    You are not authorized to post a reply.