Skip to content

Instantly share code, notes, and snippets.

View rcassani's full-sized avatar
🦫

Raymundo Cassani rcassani

🦫
View GitHub Profile
@rcassani
rcassani / toy_example_images.m
Created July 8, 2024 23:03
Cropping and merging images with Matlab
% Example of cropping and merging images in Matlab
% Get an image
peppersFileOrg = which('peppers.png');
% Show original image
figure('Name','Image: peppers.png', 'NumberTitle','off');
imPeppersOrg = imread(peppersFileOrg);
imshow(imPeppersOrg);
% Extract only the garlic from the 6 pepper_copy images
@rcassani
rcassani / plot_values_per_scout.m
Created July 8, 2024 18:13
[Brainstorm] Plot values per Scout for a given cortical parcellation
% Example of how to plot values on a given surface Atlas in Brainstorm
% Source is created using the 'Default anatomy' with its default cortex
% See: https://neuroimage.usc.edu/forums/t/46834
% Raymundo Cassani, 2024
%% Parameters
atlasName = 'Desikan-Killiany';
@rcassani
rcassani / export_freqbands2csv.m
Created June 14, 2024 15:20
[Brainstorm] Export frequency bands as CSV files
% Example of how to export individual frequency bands (from a time-frequency file) as CSV files in Brainstorm
% See: https://neuroimage.usc.edu/forums/t/46834
% Raymundo Cassani, 2024
%% Paramters
% Input files
sFiles = {'Subject01/S01_AEF_20131218_01_600Hz_notch/timefreq_hilbert_240614_1018.mat'};
@rcassani
rcassani / moinmoin_FB_button.txt
Last active September 22, 2023 16:31
Div on top of FB button
<div onclick="location.href='https://www.facebook.com/BrainstormSoftware';" style="position: relative; float: right; clear: right; margin-top: 5px; margin-right:-3px; cursor: pointer;">
<div class="fb-like" data-href="http://www.facebook.com/BrainstormSoftware" data-layout="button_count" data-action="like" data-show-faces="true" data-share="false">
</div>
<div style="position: absolute; top:0; left:0;width: 100%;height: 100%;">
<p>&nbsp;</p>
</div>
</div>
/* For MoinMoin, write in one line as: <<HTML(ONE_LINE_HERE)>> */
@rcassani
rcassani / process_something_raw_file.m
Created July 13, 2023 16:03
Brainstorm process: Process a raw file, create new raw file and add it to database
function varargout = process_something_raw_file( varargin )
% PROCESS_SOMETHING_RAW_FILE: Do something on a raw file, create new raw file, add it to BST database.
%
% @=============================================================================
% This software is part of the Brainstorm software:
% http://neuroimage.usc.edu/brainstorm
%
% Copyright (c)2000-2023 Brainstorm by the University of Southern California
% This software is distributed under the terms of the GNU General Public License
% as published by the Free Software Foundation. Further details on the GPL
@rcassani
rcassani / test_cmc.m
Created May 26, 2023 20:10
Connectivity tests with CMC tutorial data
% Script to run connectivity (magnitude square coherence) on data from the
% Corticomuscular coherence tutorial:
% https://neuroimage.usc.edu/brainstorm/Tutorials/CorticomuscularCoherence
%
% This is done in order to verify the difference approaches for PCA
% provided in the ScoutPca branch (by Marc)
%% Parameters
% Brainstorm version and Protocol
ProtocolName = 'TutorialCMC';
@rcassani
rcassani / dummy_fs_wfile.m
Created May 16, 2023 14:46
Create dummy (empty) FreeSurfer weight (`.w`) file
% Write empty FreeSurfer wfile
fileFullPath = '~/Desktop/dummy_rh.w';
% Create binary big-endian file
fid = fopen(fileFullPath, 'wb', 'b');
% Int16 for Latency
fwrite(fid, 0, 'int16');
% Count of vertex-value pairs to follow (3-bytes)
fwrite(fid, [0, 0, 0], 'uchar') ;
% Close file
fclose(fid);
@rcassani
rcassani / diff.less
Created December 19, 2022 20:51
`diff.less` file for language-diff Atom package. Place it at `~.atom/packages/language-diff/styles`
@import "syntax-variables";
atom-text-editor {
.syntax--diff {
&.syntax--inserted &.syntax--inserted.syntax--punctuation {
color: @syntax-color-added;
}
&.syntax--changed {
color: @syntax-color-modified;
}
@rcassani
rcassani / inheritance_python.py
Created December 14, 2022 19:14
Inheritance in Python
class Greeter(object):
def __init__(self):
print("Hi")
class PersonGreeter(Greeter):
def __init__(self, name):
super(PersonGreeter, self).__init__()
print(name)
```
@rcassani
rcassani / getLastCommit.sh
Last active February 1, 2023 20:14
Get last commit in GitHub repo
# 1. Get all info
curl -s "https://api.github.com/repos/brainstorm-tools/brainstorm3/commits?per_page=1&sha=master"
# Parse sha
curl -s "https://api.github.com/repos/brainstorm-tools/brainstorm3/commits?per_page=1&sha=master" | grep -oP '(?<=^\s\s\s\s"sha":\s").*(?=")'
# 2. Get only sha
curl -s -H "Accept: application/vnd.github.sha" "https://api.github.com/repos/brainstorm-tools/brainstorm3/commits/master"