Code Monkey home page Code Monkey logo

pgure-svt's People

Contributors

dependabot[bot] avatar ericpre avatar fengwang avatar tjof2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pgure-svt's Issues

Noise estimation sometimes goes out-of-bounds

Offending line no. 77 in noise.hpp - robust means and variance arrays are sometimes too small compared to the number of patches resulting from the quadtree segmentation:

// Perform quadtree decomposition of frames
// to generate patches for noise estimation
int maxVsize = (Nx/size)*(Ny/size);
arma::vec means = -1 * arma::ones<arma::vec>(T*maxVsize);
arma::vec vars = -1 * arma::ones<arma::vec>(T*maxVsize);

Current "fix" on line 84 doesn't always help - still get an Armadillo error on some noise estimation problems. Thanks to @bm424 for reminding me.

PGURE-SVT v0.2

Overhaul of much of the code to improve maintenance, as well as add new features and enhance performance on larger images.

The main change will be switching from standalone executable to a Python-wrapped library, thus removing need to maintain LibTIFF support and I/O functions, and easier parameter checking than currently. A compiled library can then be distributed with the next release.

Task list

  • Fix non-square images issue (#2)
  • Improve performance for larger images (#3)
  • Wrap the library for Python (#5)
  • Remove standalone file I/O (#5)
  • Check against code style guide (non-urgent)
  • Basic documentation

omp.h file not found

I am trying to compile on OSX following the installation instruction and running into the following error when running make in the build directory.

...

[ 50%] Building CXX object CMakeFiles/pguresvt.dir/src/lib-PGURE-SVT.cpp.o
/Users/grr/pgure-svt-0.3.3/src/lib-PGURE-SVT.cpp:57:10: fatal error: 'omp.h'
file not found
#include <omp.h>
^
1 error generated.

...

I'm not an expert in compiling, but have gathered that OSX is using clang and not gcc for compiling, but I'm not exactly sure how to get around this issue.

Change size of overlap between patches

Currently set to one pixel (for accuracy) which is fine for small frame sizes, but problematic in terms of both memory and performance for larger frames (512x512 etc.) - should have an option to reduce the overlap.

"error: Mat::operator(): index out of bounds"

Along with a "OSError: [WinError -529697949] Windows Error 0xe06d7363" output in the notebook. Anyway, seems to be the c++ code failing, not the python, so its a good bit less transparent.

On every few image series I have been denoising I have gotten this error in the jupyther notebook terminal window. Have not really been a problem, except now with the latest batch of really good data, almost half the series are failing, so I have to get it fixed.

Previously it seems to have come from 1) some series with corrupt data at late frames (recording error), while 2) some recordings I cannot find anything wrong with, where some it works if I rerun, while others never work. These latest, though seems to be mostly of the 2) type.

Any idea how to attack it?

edit: OSError

Version 0.3

  • HyperSpy demo with simple IPython notebook (#11)
  • Hot-pixel filter for CCD camera data (#14)
  • CMake installation option for library and executable (#15)
  • Combine CMake and distutils for straightforward Python installation (#16)
  • Python wrapper to include error-checking on parameters and data (#17)
  • Fix noise estimation bug (#19)

Aiming for April 30th.

Simple image registration

Often sample drift is a big problem in time-resolved microscopy. Although the PGURE-SVT algorithm can deal with small shifts through the use of the ARPS motion estimation step, it would be good to "pre-align" the image sequence with single pixel accuracy* to help reduce any issues.

Easiest way is to use cross-correlation.

*sub-pixel accuracy would mean interpolation, which is problematic for low SNR images

Non-deterministic results in Python

e.g. the example test

class TestSVT:
def setup_method(self, method):
cur_path = os.path.dirname(os.path.realpath(__file__))
self.seed = 123
self.X = np.load(f"{cur_path}/data.npz")["a"]
@pytest.mark.xfail()
def test_default(self):
s = SVT(
patch_size=16,
trajectory_length=15,
patch_overlap=3,
optimize_pgure=False,
lambda1=0.15,
noise_alpha=0.1,
noise_mu=0.1,
noise_sigma=0.1,
motion_estimation=True,
motion_window=7,
motion_filter=1,
n_jobs=1,
random_seed=self.seed,
)
s.denoise(self.X)
assert _hash_ndarray(s.Y_, 8) == "5c3a8c72"

seems to return non-deterministic results each time (hence the pytest.mark.xfail()). Unclear of cause at the moment.

Python wrapper

Instead of direct HDF5 support (#4), suggest wrapping the program for Python using ctypes to enable import/export of arbitrary electron microscopy formats, e.g. using HyperSpy.

Noise estimation for larger images

Noise estimation currently supports images up to 1024x1024 pixels, since PGURE-SVT was designed for small images.

Probably worth supporting larger images e.g. from a K2 camera.

Add basic HDF5 support

Enable importing of HDF5 files as well as TIFF stacks (will require libhdf5 linking).

Enable masking of image regions

Currently PGURE-SVT acts on the full image sequence. However, there are cases e.g. in an aligned/registered image sequence where certain regions of the frame should not be included in the denoising, as they are not part of the field of view.

Currently the only way to deal with this is to crop the full image sequence to the correct size, but this loses information in other frames. Adding a masking feature would be useful.

Filter for hot pixels

In the absence of a robust PCA approach using multiple SVT iterations and an l1-norm, a simple method for detecting hot pixels in CCD data needs to be implemented.

Release

@tjof2, would it be possible to make a release? It would be convenient to have #58 release. Thanks!

can't import hspy

Thanks for the module. Looks interesting and I was trying to test it in an Ubuntu PC. I ran the example notebook to see if things are working, but got the following error:
image

Do you have any idea why isn't it working?

Thanks, Biswajit

Error example

When building using conda-build, the example of README.md raises an error:

import numpy as np
from pguresvt import pguresvt

# Example dataset has dimensions (nx, ny, T),
# in this case a 128x128px video with 25 frames
X = np.random.randn(128, 128, 25)

# Initialize the algorithm
# with default parameters
svt = pguresvt.SVT()

# Run the algorithm on the data X
svt.denoise(X)
error: 
error: Mat::operator(): index out of boundsMat::operator(): index out of bounds

terminate called after throwing an instance of 'std::logic_error'
terminate called recursively
  what():  Mat::operator(): index out of bounds

The test suite works fine.

Support multiple dtypes

Currently the Python wrapper converts the data to np.uint16 - but the C++ does support different types. Supporting float and double would be a good start.

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.