Code Monkey home page Code Monkey logo

python-temika-reader's Introduction

python-temika-reader

A lightweight python class to read .movie files and do the basics.

A quick how-to

First clone the repository

git clone [email protected]:gnhm/python-temika-reader.git

or, if this is complicated for you, download it.

Next, import the Movie class and create an instance of it

from pytmk import Movie

m = Movie("/home/crsid/data/super_cool_experiment.movie")

Now you can use m in a variety of ways

get_frame_header(int i) gives you the Temika header information for the ith frame in the format of a dictionary.

m.get_frame_header(10)
{'avt_channel_balance': 31092,
 'avt_channel_balance_mode': 0,
 'brightness': 120,
 'brightness_mode': 2,
 'camera_type': 1,
 'color_coding': 357,
 'data_depth': 16,
 'exposure': 236,
 'exposure_mode': 1,
 'gain': 0,
 'gain_mode': 2,
 'gamma': 1024,
 'gamma_mode': 1,
 'guid': 49712223535706612,
 'image_bytes': 100352,
 'length_data': 100352,
 'length_header': 172,
 'magic': 1231906132,
 'model_id': 1,
 'movie_version': 1,
 'pix_num': 50176,
 'pixel_mode_code': 2,
 'pos_x': 368,
 'pos_y': 34,
 'shutter': 252,
 'shutter_mode': 2,
 'size_x': 224,
 'size_x_max': 1920,
 'size_y': 224,
 'size_y_max': 1200,
 'stride': 448,
 'temperature': 3167,
 'temperature_mode': 2,
 'timestamp': 1620385231858162,
 'total_bytes': 100352,
 'trigger_delay': 0,
 'trigger_delay_mode': 1,
 'trigger_mode': 4294967295,
 'vendor_id': 45213,
 'video_mode': 0}

get_frame_header(int i) gives you the Temika header information for the ith frame in the format of a dictionary.

To get the ith frame as a numpy array, use

m.get_frame(10)

You can then manipulate the frame, analyze it, save it as a .tiff or .png using PIL, or do whatever else you feel like!

A convenient method is m.frames(). This returns a generator for frames. It functions like the Python range function.

m.frames() #Generator for all frames in the movie
m.frames(100) #For the first 100 frames
m.frames(20, 100, 2) #For frames 20 to 100, in steps of 2

A few useful attributes are

m.filename
m.n_frames
m.header
'/home/crsid/data/super_cool_experiment.movie'
5000
'Temika header describing what I did.'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.