flika-org / flika

An interactive image processing program for biologists written in Python.
http://flika-org.github.io/
MIT License
22 stars 1 forks source link

Kymograph of a rectangle ROI #48

Open biswajitSM opened 5 years ago

biswajitSM commented 5 years ago

Hi, Is it possible to get the kymograph from a rectangle selection? I can only get kymograph for a line. It would be nice if the pixels on one side could be averaged and then plot kymograph.

Thanks Biswajit

kyleellefsen commented 5 years ago

Yes, it should be possible. In flika/roi.py, the ROI_line class has all the kymograph related functions. It should be pretty straightforward to copy those functions to the ROI_rectangle class located in the same file. The code that would need to be changed in the transfer is the averaging, and the ability to select whether the kymograph is an x_kymograph and y_kymograph.

A more elegant solution might be to have a setting when creating the kymograph from the ROI_line that specifies the width to average, with the default being 1 pixel. This could be a dialog box that pops up after you make the selection for 'Kymograph', or it could be a setting of the line itself, set by right clicking the line icon in the main window. If it's a dialog box it won't be hidden from the user, but it might get annoying to select the width every time.

I probably won't implement this, but if you want to discuss it and submit a pull request I'd be happy to include it.

biswajitSM commented 5 years ago

Thanks for the suggestions and ideas to implement this. It's taking time for me to get used to the PyQt syntaxes. but I like the second option where you could simply change the thickness. it can also allow to use any orientation. I will try to implement it and send a pull request.