Browse Source

Upload files to ''

Andrey Formozov 1 year ago
parent
commit
28565f1da4

+ 1 - 0
Results_preprocessed_Examples/Folder_with_recordings/avi/dp7-leAXw1118video0025312.mp4.avi

@@ -0,0 +1 @@
+/annex/objects/MD5-s138418850--61aeae209a4eb67505c6730bd475c5f2

+ 1 - 0
Results_preprocessed_Examples/Folder_with_recordings/avi/dp7-leAXxLexAopkir2-023212.mp4.avi

@@ -0,0 +1 @@
+/annex/objects/MD5-s138418850--ca40bcf54a2fd0d8121898675e786601

BIN
Results_preprocessed_Examples/Folder_with_recordings/avi_masked/dp7-leAXw1118video0025312.mp4.avi


BIN
Results_preprocessed_Examples/Folder_with_recordings/avi_masked/dp7-leAXxLexAopkir2-023212.mp4.avi


BIN
Results_preprocessed_Examples/Folder_with_recordings/crop/dp7-leAXw1118video0025312.mp4


BIN
Results_preprocessed_Examples/Folder_with_recordings/crop/dp7-leAXxLexAopkir2-023212.mp4


+ 45 - 0
Results_preprocessed_Examples/Folder_with_recordings/means/dp7-leAXw1118video0025312.mp4.avi.csv

@@ -0,0 +1,45 @@
+ ,Mean1,Mean2,Mean3,Mean4
+1,1.235,2.626,2.130,0.922
+2,1.261,2.334,2.017,1.536
+3,0.984,2.399,1.483,1.703
+4,1.076,2.259,1.505,1.791
+5,0.961,2.345,1.305,2.086
+6,0.788,2.679,1.537,1.639
+7,0.856,2.587,1.599,1.361
+8,0.701,2.834,1.692,1.444
+9,0.947,2.833,1.859,1.183
+10,0.703,2.707,2.052,1.148
+11,0.593,2.898,1.889,1.113
+12,0.816,2.768,2.082,1.144
+13,0.820,2.459,1.975,0.814
+14,0.908,2.800,2.043,0.903
+15,0.715,2.963,1.815,1.246
+16,0.604,3.025,1.913,1.203
+17,0.487,3.152,2.019,1.256
+18,0.423,3.076,1.828,1.280
+19,0.740,3.133,1.873,1.303
+20,0.698,3.044,1.764,1.202
+21,0.955,2.869,1.751,1.380
+22,0.755,2.922,1.556,1.733
+23,0.851,2.856,1.704,1.135
+24,1.040,2.547,1.879,1.118
+25,1.041,2.959,1.761,1.179
+26,1.407,1.911,1.605,1.503
+27,1.301,2.304,2.100,1.270
+28,1.619,2.263,1.868,1.208
+29,1.131,2.635,1.593,1.350
+30,1.380,2.570,1.891,1.147
+31,1.758,2.233,1.695,1.159
+32,1.504,2.491,1.859,0.974
+33,1.314,2.474,1.815,1.004
+34,1.095,2.684,2.100,0.813
+35,1.487,2.396,2.263,0.852
+36,1.076,2.804,2.152,1.015
+37,1.308,2.718,1.939,0.942
+38,1.331,2.578,1.781,1.118
+39,1.097,2.856,1.649,1.197
+40,1.306,2.766,1.770,1.293
+41,1.311,2.442,2.040,1.015
+42,0.990,3.009,2.217,1.146
+43,0.607,3.105,2.279,0.862
+44,0.655,2.963,2.092,0.961

+ 45 - 0
Results_preprocessed_Examples/Folder_with_recordings/means/dp7-leAXxLexAopkir2-023212.mp4.avi.csv

@@ -0,0 +1,45 @@
+ ,Mean1,Mean2,Mean3,Mean4
+1,1.619,2.514,1.974,0.792
+2,1.179,2.540,2.731,0.855
+3,1.291,1.844,2.022,1.261
+4,1.444,1.779,1.838,1.321
+5,1.672,1.731,2.110,1.183
+6,1.525,1.613,2.118,1.358
+7,1.179,2.215,2.516,0.870
+8,1.088,1.586,2.187,0.731
+9,1.249,1.999,2.251,0.820
+10,1.199,1.425,2.314,0.479
+11,1.045,1.653,2.245,0.390
+12,1.007,1.670,2.555,0.325
+13,0.618,2.267,2.532,0.238
+14,0.710,2.238,2.052,0.368
+15,0.763,2.527,2.126,0.653
+16,0.774,2.162,2.331,0.510
+17,1.406,1.386,2.353,0.523
+18,1.869,0.995,1.892,1.024
+19,2.200,1.010,1.513,1.160
+20,1.871,1.232,1.740,1.301
+21,2.378,0.659,2.031,1.071
+22,2.399,0.597,1.891,1.261
+23,2.569,0.611,1.699,1.723
+24,2.393,0.620,1.833,1.128
+25,2.557,0.463,2.275,0.901
+26,2.253,0.758,2.023,1.063
+27,2.140,1.010,2.363,0.793
+28,1.707,1.228,2.300,0.842
+29,2.156,0.876,2.392,1.125
+30,1.961,1.260,1.893,1.331
+31,1.914,1.073,2.311,0.828
+32,1.987,1.072,1.875,0.946
+33,1.843,1.182,1.911,1.353
+34,2.293,0.685,2.523,0.878
+35,2.008,0.910,2.007,0.978
+36,2.280,0.880,1.814,1.309
+37,2.176,0.935,1.864,1.239
+38,2.525,0.710,1.837,1.348
+39,2.460,0.680,1.296,1.856
+40,2.064,1.062,1.575,1.613
+41,1.650,1.259,1.713,1.530
+42,1.767,1.374,1.565,1.717
+43,1.965,1.200,2.435,0.708
+44,2.292,0.887,2.456,0.954

BIN
Results_preprocessed_Examples/Folder_with_recordings/reduce/dp7-leAXw1118video0025312.mp4


BIN
Results_preprocessed_Examples/Folder_with_recordings/reduce/dp7-leAXxLexAopkir2-023212.mp4


+ 53 - 0
Results_preprocessed_Examples/Folder_with_recordings/reprocess_avi_and_get_means.ijm

@@ -0,0 +1,53 @@
+function action(input, output_means,output_avi, filename) {
+        print(filename);
+        open(input + filename);
+        run("8-bit");
+        run("Z Project...", "projection=[Average Intensity]");
+        imageCalculator("Subtract create stack", filename,"AVG_"+filename);
+        selectWindow("Result of "+filename);
+        setAutoThreshold("Default dark");
+		run("Threshold...");
+		setThreshold(62, 255);
+		setOption("BlackBackground", true);
+		run("Convert to Mask", "method=Default background=Dark black");
+		saveAs("avi", output_avi + filename);
+		run("ROI Manager...");
+		makeRectangle(0, 0, 512, 1024);
+		roiManager("Add");
+		makeRectangle(512, 0, 512, 1024);
+		roiManager("Add");
+		makeRectangle(1024, 0, 512, 1024);
+		roiManager("Add");
+		makeRectangle(1536, 0, 512, 1024);
+		roiManager("Add");
+		run("Set Measurements...", "mean redirect=None decimal=3");
+		roiManager("Multi Measure");
+		roiManager("Measure");
+		roiManager("Multi Measure");
+		// applyMacro doesn't work 
+		//Table.applyMacro("Sum12 = Mean1 + Mean2 Sum34 = Mean3 + Mean4 Index12 = (Mean1 - Mean2)/(Mean1 + Mean2) Index34 = (Mean3 - Mean4)/(Mean3 + Mean4)");
+		saveAs("Results", output_means +  filename + ".csv");
+		roiManager("delete");
+		run("Close All");
+		
+}
+// Modify this path
+path = "/home/andrey/Desktop/Protocol/test/"
+
+input = path + "avi/";
+
+File.makeDirectory(path + "means/");
+File.makeDirectory(path + "avi_masked/");
+
+output_means = path + "means/";
+output_avi = path + "avi_masked/";
+
+// reprocess images
+
+//setBatchMode(true);
+ 
+list = getFileList(input);
+for (i = 0; i < list.length; i++){
+        action(input, output_means,output_avi, list[i]);
+}
+//setBatchMode(false);

+ 28 - 0
Results_preprocessed_Examples/Folder_with_recordings/reprocess_videos_linux.sh

@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# This is a bash script to downsample (reduce), crop and convert *.mp4 files to *.avi format
+# Locate this script in the folder where *.mp4 files are located
+# This version of the script is for Linux users
+# The script can be executed on Windows as well if appropriate software for bash execution is installed (consider, for example, Git Bash as an option). 
+
+# To activate or deactivate a certain preprocessing step remove "#"-sign prior to ffmpeg command below 
+# Make sure that ffmpeg software is installed. It also should be executable from the command line, otherwise add prior to "ffmpeg" command the full path to where ffmpeg software is located.
+
+# DEFINE THESE PARAMETERS and test the script (it is recommended to use a short video for the test)
+
+take_each_n_frame=200
+width=2048 
+height=1024
+X=0
+Y=300
+
+
+mkdir reduce
+mkdir crop
+mkdir avi
+
+for filename in ./*.mp4; do
+    ffmpeg -i $filename -vf "select=not(mod(n\,$take_each_n_frame))" -vsync vfr -q:v 2 reduce/$filename
+    ffmpeg -i reduce/$filename -filter:v "crop=$width:$height:$X:$Y" -c:a copy crop/$filename
+    ffmpeg -i crop/$filename -pix_fmt nv12 -f avi -vcodec rawvideo avi/$filename.avi
+done

+ 34 - 0
Results_preprocessed_Examples/Folder_with_recordings/reprocess_videos_windows.bat

@@ -0,0 +1,34 @@
+:: Add the path to ffmpeg into the Path variable (see Windows enviroment variables)
+:: See https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/
+:: for more details
+:: Locate this script in the folder with *.mp4 files
+:: Run the script in the folder or, alternatively, run it though the Command prompt
+:: Run Command prompt in Windows
+:: Using Command prompt go to the folder with *.mp4 files by typing:
+:: cd C:\Users\....\path_to_files\
+:: In case the files are located not on C: hard drive but on the other disk (for example Q:), type
+:: Q:
+:: to switch to this hard drive
+:: Run script by typing
+:: reprocess_videos_windows.bat
+
+:: DEFINE THESE PARAMETERS and test the script (it is recommended to use a short video for the test)
+
+SET /A take_each_n_frame = 200 
+SET /A width = 2048 
+SET /A height = 1024
+SET /A X = 0
+SET /A Y = 300
+
+ECHO "Analysis script"
+
+mkdir reduce
+mkdir crop
+mkdir avi
+
+for %%f in (*.mp4) do (
+echo "%%f"
+ffmpeg -i "%%f" -vf "select=not(mod(n\,%take_each_n_frame%))" -vsync vfr -q:v 2 reduce/"%%f"
+ffmpeg -i reduce/"%%f" -filter:v "crop=%width%:%height%:%X%:%Y%" -c:a copy crop/"%%f"
+ffmpeg -i crop/"%%f" -pix_fmt nv12 -f avi -vcodec rawvideo avi/"%%f.avi"
+)