nclack / whisk

Fully automated tracking of single rows of whiskers in high-speed video.
https://openwiki.janelia.org/wiki/display/MyersLab/Whisker+Tracking
Other
9 stars 13 forks source link

How to toggle off stripe correction on the command line? #45

Closed gmorenomello closed 6 years ago

gmorenomello commented 6 years ago

I need to process many files and I am having a problem that whiki is creating stripe artifacts instead of removing it. Now, when I go in whiski I can eliminate it by clicking "s". How can I do the same with the command line?

nclack commented 6 years ago

Unfortunately, it looks like this requires changing some code:

This line:

  TRY(im=video_get(v,index,1),ErrorRead);

needs to be changed to this:

 TRY(im=video_get(v,index,0),ErrorRead);

And then you have to rebuild everything. It can be hard to build the code. What operating system are you using?

nclack commented 6 years ago

In case it helps, the README has some instructions on building.

gmorenomello commented 6 years ago

Windows 10 and MacOsX

Em 25 de set de 2018, à(s) 14:45, Nathan Clack notifications@github.com escreveu:

Unfortunately, it looks like this requires changing some code:

This line https://github.com/nclack/whisk/blob/d938b9d8dc332d0494cbced6ae844c0ff8250b46/src/whisk.c#L59:

TRY(im=video_get(v,index,1),ErrorRead); needs to be changed to this:

TRY(im=video_get(v,index,0),ErrorRead); And then you have to rebuild everything. It can be hard to build the code. What operating system are you using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nclack/whisk/issues/45#issuecomment-424328181, or mute the thread https://github.com/notifications/unsubscribe-auth/ApiWhT6NaquSYDJEjVFMeSILGxj-6S8Kks5ueiVpgaJpZM4W3caX.

gmorenomello commented 6 years ago

Ok I will try Thanks

Em 25 de set de 2018, à(s) 14:56, Nathan Clack notifications@github.com escreveu:

the README ha

ninjasatwork commented 6 years ago

I tried to compile it in the MACOSX and received the following error message: -- Found unsuitable Qt version "5.6.2" from /Users/gbmello/anaconda3/bin/qmake searching /Applications/MATLAB_R2016b.app Searching /Applications/MATLAB_R2016b.app ... /Applications/MATLAB_R2016b.app/bin/glnxa64 Searching /Applications/MATLAB_R2016b.app ... /Applications/MATLAB_R2016b.app/bin/maci64 CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: OGG_LIBRARY (ADVANCED) linked by target "vsplit" in directory /Users/gbmello/Dropbox/CODE/whisk-master linked by target "totif" in directory /Users/gbmello/Dropbox/CODE/whisk-master linked by target "seedtest" in directory /Users/gbmello/Dropbox/CODE/whisk-master linked by target "preprocess" in directory /Users/gbmello/Dropbox/CODE/whisk-master linked by target "trace" in directory /Users/gbmello/Dropbox/CODE/whisk-master linked by target "stripetest" in directory /Users/gbmello/Dropbox/CODE/whisk-master linked by target "whiskio" in directory /Users/gbmello/Dropbox/CODE/whisk-master linked by target "whisk" in directory /Users/gbmello/Dropbox/CODE/whisk-master

-- Configuring incomplete, errors occurred! See also "/Users/gbmello/Dropbox/CODE/whisk-master/buildMac/CMakeFiles/CMakeOutput.log". (base) 1x-193-157-207-112:buildMac gbmello$

any ideas on how should I set them? and what QT is required?

gmorenomello commented 6 years ago

Hey Nathan,

I tried to follow your recommendations. I tried to compile first in MacOsX Sierra and then in Windows 10. Both of them failed.

The code seems to be looking for variables that I am supposed to have. In mac you can see the previous post. In PC (Windows 10) the message is as follows:

-- Building for: Visual Studio 15 2017 -- Selecting Windows SDK version 10.0.17134.0 to target Windows 10.0.16299. -- The C compiler identification is MSVC 19.14.26433.0 -- The CXX compiler identification is MSVC 19.14.26433.0 -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x86/cl.exe -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x86/cl.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x86/cl.exe -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x86/cl.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done awk not found. Using previously generated mylib c files in C:/Users/gbmello/Dropbox/environments/whisk/generated. MYLIB_SRCS is C:/Users/gbmello/Dropbox/environments/whisk/src/generated/contour_lib.c;C:/Users/gbmello/Dropbox/environments/whisk/src/generated/draw_lib.c;C:/Users/gbmello/Dropbox/environments/whisk/src/generated/image_filters.c;C:/Users/gbmello/Dropbox/environments/whisk/src/generated/image_lib.c;C:/Users/gbmello/Dropbox/environments/whisk/src/generated/level_set.c;C:/Users/gbmello/Dropbox/environments/whisk/src/generated/utilities.c;C:/Users/gbmello/Dropbox/environments/whisk/src/generated/water_shed.c -- Could NOT find BISON (missing: BISON_EXECUTABLE) Bison not found. Using previously generated parameter parser. -- Found unsuitable Qt version "" from NOTFOUND searching C:/Program Files/Matlab/R2017a Searching C:/Program Files/Matlab/R2017a ... C:/Program Files/Matlab/R2017a/extern/lib/win32/microsoft/msvc71 Searching C:/Program Files/Matlab/R2017a ... C:/Program Files/Matlab/R2017a/extern/lib/win32/microsoft -- Configuring done -- Generating done -- Build files have been written to:

C:/Users/gbmello/Dropbox/environments/whisk/build

After this, when I try to run make it says that there is no such file. It doesnt find Bison, I added it to the system environment and nothing. Also it is complaining about the version of QT and I have no idea which one to use. I have the Qt5.2 installed I have installed Bison, Gawk, Cmake and QT. I ran out of ideas.

Could you please point me out what am I doing wrong?

nclack commented 6 years ago

On windows, cmake will generate a visual studio solution (a .sln file) instead of a makefile. See here for more info. You'll need visual studio installed to build the software.

The good news is it looks like the cmake step worked. If you see these lines at the end, that's a good sign:

  -- Configuring done
  -- Generating done

You can run cmake-gui to inspect settings that cmake used during configuration. For example if you search for BISON, you'll find the variable used and you can point that to where you installed it (It doesn't look like you need bison though).

gmorenomello commented 6 years ago

So I managed to make it work. Nonetheless the tracking that it provides me is still consistent with the tracking with the stripe correction. I tried to open it in Whiski to check. And when I remove the stripe correction there and ask it to trace, the whiskers are traced correctly. So it is unlikely to be the image itself.

Is there anywhere else that I might be missing to change in the code?

nclack commented 6 years ago

Is there way you can show me what you changed so I can double check?

I'll link you to the functions where the strip correction is done so you can verify (via breakpoints or printfs etc) whether they are still being called. They are here and here.

gmorenomello commented 6 years ago

Is there a way I can send you a small mp4 clip so you can check if you can trace it?

gmorenomello commented 6 years ago

the parts of the code responsible for the vertical lines are not being executed. can you just double check With Your machine? you might get a better Insight of why I cannot properly trace this https://www.dropbox.com/s/4qgy41jygwkx1vw/20180730_1210_12-10-21.000_part_1.mp4?dl=0

nclack commented 6 years ago

There's something strange about the timing information in the mpg. I think whisk isn't seeking around to the correct frames. If I seek forward in whiski, the video looks fine, but it doesn't seek backwards correctly. This thread might help. You might consider extracting a small part of the video to a tiff stack and checking if that changes anything.

That said, I can get the tracing to find some of the trimmed whiskers near the face, but the untrimmed whisker gives me trouble. There's a set of parameters saved in the default.parameters file. That file either lives in the current working directory or in your install directory (C:\Program Files\WhiskerTracking). I was able to get some success by changing the HALF_SPACE_ASSYMETRY_THRESH to 1.0. You have a slight background gradient from left to right across the image. I thought that might be tripping this threshold. It's used to stop tracing near the face or near collisions with other objects.

I'm not quite sure, but I think the noisy line on the right side of the image might was causing the "stripe adjustment" to be especially bad. Turning the stripe-adjust off is the correct thing to do as your camera produces beautiful images (save for that one line).

gmorenomello commented 6 years ago

This video seems to track ok. But here is what I found in other video. screenshot 5

Any idea? Also, it seems that it tracks the whisker with less mistakes if the tip of the whisker is visible. Is that part of the algorithm somewhere? I missed in the paper.

tvajtay commented 6 years ago

I was able to track fine without seeing the whisker tip, I don't believe it is needed for segmentation. One of my kludge fixes for video artifacts was to do a Gaussian blur and increase contrast in imagej so I could retain the general whisker profile while smudging out the artifacts. I don't know if that's relevant here.

gmorenomello commented 6 years ago

It puzzles me, why would I have Horizontal lines now? @nclack do you have any hypothesis? also I changed the default.parameter that is inside the build folder (I use the c functions directly from there) and observed no difference in tracing. horizontal error file. https://www.dropbox.com/sh/zz2e2dzrrr650g3/AACySO4tHJhNg6RkgG6Tr5Sua?dl=0

gmorenomello commented 6 years ago

I tryied tvajtay's solution and worked like a charm. I had to use the gaussian blur and the adaptive histogram equalization. With these two I was able to improve tracking. Here is the caveat. MP4 files actually (for whatever reason) make trigger something in the algorithm that makes it to track parallel lines, either horizontal or vertical (I still do not know why one over the other). For his solution to work it is necessary to extract the videos from SEQ to uncompressed avi. In this case it seems to be working. I will run some more files and confirm whether this solution is stable.

nclack commented 6 years ago

@gmorenomello @tvajtay Fantastic! You folks are awesome.