-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Wenlab/develop
v1.1.0
- Loading branch information
Showing
39 changed files
with
224 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
full_path_red = "F:\1_learning\research\taxis of C.elegans\Calcium Imaging\data\WEN0234_check\w1_ND16_2024-04-10_22-57-56\0_Camera-Red_VSC-10629\00006265.tif"; | ||
full_path_green = "F:\1_learning\research\taxis of C.elegans\Calcium Imaging\data\WEN0234_check\w1_ND16_2024-04-10_22-57-56\1_Camera-Green_VSC-09321\00006264.tif"; | ||
|
||
% Step 1: Read the image files | ||
red = imread(full_path_red); % Read the red channel image | ||
green = imread(full_path_green); % Read the green channel image | ||
|
||
% Step 2: Horizontally flip the green channel image | ||
green_flipped = fliplr(green); % Flip the green image horizontally | ||
|
||
% Step 3: Combine the red and flipped green images into a single image | ||
% Create an empty 3-channel image of the same size | ||
% Note: The blue channel remains zero, so where red and green overlap, the color will be yellow | ||
combined = zeros(size(red, 1), size(red, 2), 3, 'uint8'); | ||
|
||
% Assign the red channel to the first channel of the RGB image | ||
combined(:, :, 1) = red; | ||
|
||
% Assign the flipped green channel to the second channel | ||
combined(:, :, 2) = green_flipped; | ||
|
||
imshow(combined); | ||
|
||
% Step 4: Save the resultant image | ||
imwrite(combined, 'combined_yellow.tif'); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion
1
code/intensity_and_mask_to_intensity.m → ...orkflow/intensity_and_mask_to_intensity.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
%% test | ||
% intensity of frames and mask to intensity of volumes, using | ||
% mean, max or median pooling | ||
% | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function write_to_a_video(output_video,binary_frame) | ||
|
||
% Write a binary frame to a video, making 1 becomes 255 and 0 remains 0. | ||
% | ||
% Yixuan Li, 2024-04-15. | ||
% | ||
|
||
binary_frame_uint8 = uint8(binary_frame) * 255; | ||
writeVideo(output_video, binary_frame_uint8); | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
% Define the video file | ||
videoFile = ''; | ||
|
||
% Create a VideoReader object to read video data | ||
vidObj = VideoReader(videoFile); | ||
|
||
% Prepare to write GIF | ||
outputGif = 'output.gif'; | ||
delayTime = 1 / vidObj.FrameRate; % Delay time between frames in seconds | ||
|
||
% Initialize a variable to control GIF initialization | ||
firstFrame = true; | ||
|
||
% Read and write each frame | ||
while hasFrame(vidObj) | ||
frame = readFrame(vidObj); % Read a frame | ||
[imind, cm] = rgb2ind(frame, 256); % Convert frame to indexed image | ||
|
||
% Write frame to GIF | ||
if firstFrame | ||
imwrite(imind, cm, outputGif, 'gif', 'Loopcount', inf, 'DelayTime', delayTime); | ||
firstFrame = false; % Update flag after first frame is written | ||
else | ||
imwrite(imind, cm, outputGif, 'gif', 'WriteMode', 'append', 'DelayTime', delayTime); | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
% Specify the video file | ||
folderPath = 'F:\1_learning\research\taxis of C.elegans\Calcium Imaging\data\WEN0234_check\w3_ND16_2024-04-10_23-28-30\1_Camera-Green_VSC-09321'; | ||
fileName = "Gauss_Adapt_size_3_std_3_sense_0.2000___disk_3___green_after_applying_all_template.mp4"; | ||
videoFile = fullfile(folderPath,fileName); | ||
|
||
% Create a video reader object | ||
vidObj = VideoReader(videoFile); | ||
|
||
% Define the output folder for PNG files | ||
outputFolder = 'F:\1_learning\research\taxis of C.elegans\Calcium Imaging\data\temp'; | ||
if ~exist(outputFolder, 'dir') | ||
mkdir(outputFolder); % Create the folder if it doesn't exist | ||
end | ||
|
||
% Initialize a frame counter | ||
frameCounter = 0; | ||
|
||
% Read and write each frame | ||
while hasFrame(vidObj) | ||
frame = readFrame(vidObj); % Read one frame | ||
frameCounter = frameCounter + 1; % Increment the frame counter | ||
% Create a filename for each output image | ||
filename = fullfile(outputFolder, sprintf('frame_%06d.png', frameCounter)); | ||
imwrite(frame, filename); % Write the frame to a PNG file | ||
end | ||
|
||
% vidObj closes automatically when the function exits |
Oops, something went wrong.