thanks for reading.
I´m new in the world of neuroimaging, where I want to quantify certain structures in the brain (Locus coeruleus), using ANTS and a Probabilistic Atlas of the Human Locus Coeruleu (https://www.nitrc.org/projects/lc_7t_prob/)
The creators of the atlas provide a pipeline, which I attach below. My question is, if I have the database of subjects with their respective MRI images (T1, FLAIR, etc), how do I run the pipeline using ANTS, to quantify through the atlas?
I´m currently working on macOS M1
pipeline:
#!/bin/bash
module load ANTS/2.2.0
#1. Build averaged MT-on image while registering individual images in an unified step
antsMultivariateTemplateConstruction2.sh -d 3 -o t_ -i 4 -g 0.1 -j 1 -c 5 -k 1 -w 1 -f 8x4x2x1 -s 3x2x1x0 -q 100x70x50x20 -n 1 -r 1 -l 1 -m MI -t Rigid *LC_SN_112*.nii.gz
#2. Co-register MT-off image to the corresponding individual averaged MT-on image
N4BiasFieldCorrection -d 3 -i noMT.nii.gz -o n4_noMT.nii -r 1 -c [50x50x30x20,1e-6] -b [200];
gzip n4_noMT.nii
antsRegistration -v 1 -d 3 -o noMT_to_average -n Linear -u 0 -w [0.005,0.995] -r [t_template0.nii.gz,n4_noMT.nii.gz,1] -t Rigid[0.1] -m MI[t_template0.nii.gz,n4_noMT.nii.gz,1,32,Regular,0.25] -c [1000x500x250x100,1e-6,10] -f 12x8x4x2 -s 4x3x2x1vox -x [NULL,NULL] -u 0
antsApplyTransforms -d 3 -i n4_noMT.nii.gz -o noMT_to_template0.nii.gz -r t_template0.nii.gz -n Linear -t noMT_to_average0GenericAffine.mat
#3. Co-register MT-off image to the corresponding individual T1 MP2RAGE image
antsRegistration -v 1 -d 3 -o [noMT_to_T1,noMT_to_T1Warped.nii.gz,noMT_to_T1InverseWarped.nii.gz] -n Linear -u 0 -w [0.005,0.995] -t Rigid[0.1] -m MI[n4mag0000_PSIR_std.nii,n4_noMT.nii.gz,1,32,Regular,0.25] -c [1000x500x250x100,1e-6,10] -f 12x8x4x2 -s 4x3x2x1vox -x [NULL,NULL] -u 0
antsApplyTransforms -d 3 -i n4_noMT.nii.gz -o noMT_to_T1.nii.gz -r n4mag0000_PSIR_std.nii -n Linear -t noMT_to_T10GenericAffine.mat
#4. Build the study-wise T1 template
antsMultivariateTemplateConstruction2.sh -d 3 -c 5 -g 0.1 -i 6 -q 100x100x70x50x20 -f 10x6x4x2x1 -s 5x3x2x1x0vox -n 0 -o T1TMP_ -r 0 -l 1 -m CC -t SyN -k 1 -v 8gb T1_list_brain_CSFin_denoised_n53.txt
#5. Coregister T1 template to the ICBM2009b template
source=T1TMP_template0.nii
target=mni_icbm152_t1_tal_nlin_asym_09b_hires_FSL_bbox_struc_brain_CSFin.nii
antsRegistration \
--verbose 1 \
--dimensionality 3 \
--float 0 \
--output \
[T1TMP_53_To_MNI152,T1TMP_53_To_MNI152_Warped.nii.gz,T1TMP_53_To_MNI152_InverseWarped.nii.gz] \
--interpolation Linear \
--use-histogram-matching 0 \
--winsorize-image-intensities [0.005,0.995] \
--initial-moving-transform [${target},${source},1] \
--transform Rigid[0.1] \
--metric CC[${target},${source},1,4] \
--convergence [100x70x50x50,1e-6,10] \
--shrink-factors 8x4x2x1 \
--smoothing-sigmas 3x2x1x0vox \
--transform Affine[0.1] \
--metric MI[${target},${source},1,32,Regular,0.25] \
--convergence [1000x500x250x100,1e-6,10] \
--shrink-factors 12x8x4x2 \
--smoothing-sigmas 4x3x2x1vox \
--transform SyN[0.1,3,0] \/Users/VictorVidal/R08_t1_mprage_sag_p2_iso_20180520172539_5.nii
--metric CC[${target},${source},1,4] \
--convergence [100x100x70x50x20,1e-6,10] \
--shrink-factors 10x6x4x2x1 \
--smoothing-sigmas 5x3x2x1x0vox \
#6. Coregister averaged MT-on images to MNI space
antsApplyTransforms -d 3 -i ${MT_Path}/t_template0.nii.gz -o ${output_Path}/avgMT_to_MNI_TL_CC.nii.gz -r ${MNI_Path}/mni_icbm152_t1_tal_nlin_asym_09b_hires_FSL_bbox_struc_brain_CSFin.nii -n Linear -t ${MNI_Path}/T1TMP_54_CC_To_MNI152_T109b_FSL_bbox_brain_CSFin_RegAllCC1Warp.nii.gz -t ${MNI_Path}/T1TMP_54_CC_To_MNI152_T109b_FSL_bbox_brain_CSFin_RegAllCC0GenericAffine.mat -t ${T1_Path}/T1TMP_${subj}_*1Warp.nii.gz -t ${T1_Path}/T1TMP_${subj}_*.mat -t [${MT_Path}/T1_to_noMT0GenericAffine.mat,1] -t [${MT_Path}/noMT_to_average0GenericAffine.mat,1] -v 1```
Related
I'm using iTerm2's hotkey window to open a default set of tmux panes whenever I first launch the window. I have a file named .hotkeyconfig I'm using to source the commands necessary to size the window.
tmux new -s hotkey \; \
select-pane -t 0 \; \
split-window -h \; \
resize-pane -t 0 -L 34 \; \
split-window -h \; \
resize-pane -L 15 \; \
split-window -h \; \
resize-pane -R 19 \; \
select-pane -t 1 \; \
split-window -v \; \
resize-pane -U 2 \; \
resize-pane -R 10 \; \
select-pane -t 0 \; \
I call this when the window starts with:
source ~/.hotkeyconfig
When there's another attached tmux session using this command produces the top result, however if the hotkey window is the only attached tmux session, it produces the output on the bottom.
output
What is causing this inconsistent behavior and how can I fix it?
I want to generate logo with selenocysteine, but when i choose option with reduced_protein_alphabet i get error 'Repetative alphabet'
weblogo -f sc.txt -D fasta -o sc_logo -F pdf -a reduced_protein_alphabet -s large -n 100 -c chemistry
My solution:
Here what i've done
Check if the infile do not have errors.
add a alphabet 'ACDEFGHIKLMNPQRSTVUWY' to option -a
color aminoacids in this alphabet -C
weblogo -f sc.txt -D fasta -o logo -F pdf -n 100 -A protein -a 'ACDEFGHIKLMNPQRSTVUWY' -s large -C yellow U selenocysteine -C red DE acidic -C black AVLIPWFM Hydrophobic -C blue KRH basic -C purple QN Neutral -C green GSTYC Polar
I didn't realese it is that simple. Maybe it will help someone!
All,
I am trying to run multiple shell commands on a remote server through Jenkins
I have tried the below code with Execute Shell, plugin
sudo su
ssh -o StrictHostKeyChecking=no -i /home/ec2-user/card.pem ec2-user#10.205.75.204 cat /home/ec2-user/testfile.txt
the problem with this is i can only run one command , for more than 1 I need to run
sudo su
ssh -o StrictHostKeyChecking=no -i /home/ec2-user/card.pem ec2-user#10.205.75.204 cat /home/ec2-user/testfile.txt
ssh -o StrictHostKeyChecking=no -i /home/ec2-user/card.pem ec2-user#10.205.75.204 rm -rf /home/ec2-user/testfile.txt
how can we achieve running mutiple commands like this?
Hey # Siraj Syed check following example:
String commandToRun = 'cat /home/ec2-user/testfile.txt; rm -rf /home/ec2-user/testfile.txt'
// pipeline step
sh "ssh -o StrictHostKeyChecking=no -i /home/ec2-user/card.pem ec2-user#10.205.75.204 /bin/bash -c '\"${commandToRun}\"'"
Can you just do:
ssh -o StrictHostKeyChecking=no -i /home/ec2-user/card.pem ec2-user#10.205.75.204 "cat /home/ec2-user/testfile.txt; rm -rf /home/ec2-user/testfile.txt"
I am trying to write a script I can run/source so tmux set a specific layout and run commands. I have some results.
Here is what I've written so far:
selectp -t 1
splitw -v -p 15
splitw -h -p 50
selectp -t 1
send-keys 'cd ~/code/octoly' Enter
send-keys 'vim .' Enter
selectp -t 2
send-keys 'cd ~/code/octoly' Enter
send-keys 'drails c' Enter
new-window -d -n server -c ~/code/octoly
selectw -t 2
send-keys 'fd' Enter
splitw -h -p 50
send-keys 'cd ~/code/octoly' Enter
send-keys 'drails s' Enter
selectp -t 1
splitw -v -p 50
send-keys 'cd ~/code/octoly' Enter
send-keys 'be guard' Enter
What works more or less is the creation of the second window and the panes. Though the panes does not give me what I want. They are all created in the first window, none are created in the second.
Here is what I run to start tmux:
tmux new 'tmux move-window -t 99 \; source-file ~/.tmux/session_octoly'
Furthermore, where I'm really lost is that if I run each command by hand one by one, it gives me what I want.
What am I missing here?
First of all, you're using the -d flag in new-window that does not make the new window the current window:
If -d is given, the session does not make the new window the current window.
However I would probably spin up tmux in a different way, using tmux -f flag to use an ad-hoc config file that does what you want.
Please check the commands before running it in you're environment.
# File: ~/.tmux/octoly.conf
# Load default .tmux.conf
source-file ~/.tmux.conf
# setup octoly session
new-session -s octoly -n editor -d -c ~/code/octoly
send-keys 'vim .' Enter
split-window -v -p 15 -c ~/code/octoly
send-keys 'drails c' Enter
split-window -h -p 50 -c ~/code/octoly
# Select vim pane
select-pane -t 1
# create second window
new-window -n server -c ~/code/octoly
send-keys 'fd' Enter
split-window -h -p 50 -c ~/code/octoly
send-keys 'drails s' Enter
select-pane -t 1
split-window -v -p 50 -c ~/code/octoly
send-keys 'be guard' Enter
# Optional step, reselect window 1 (the one with vim)
select-window -t editor
Then you need to launch tmux using:
tmux -f ~/.tmux/octoly.conf attach
Another alternative would be to build a bash script sending the same commands.
Note: I've used the -c flag to specify the start directory instead of running every time a cd command. Given that every command is run in the same folder you can take them out in the split-window commands.
I am learning to use tmux, I found when I in a tmux window, double-click to select and copy function did not work any more.
Can I use double-click to select and copy just as in iterm2?
I have googled for some time, but did not find an short and clear answer to this. I have added setw -g mode-mouse on in the tmux configure file already.
I found a way to achieve that: hold the option key when double clicking.
Don't know about iterm2, but this can be made to work in tmux 3.0 or newer(tested on Linux w/ tmux 3.0, last command uses X11 xclip).
Added triple click to select and copy a line too.
# Double LMB Select & Copy (Word)
bind-key -T copy-mode-vi DoubleClick1Pane \
select-pane \; \
send-keys -X select-word-no-clear \; \
send-keys -X copy-pipe-no-clear "xclip -in -sel primary"
bind-key -n DoubleClick1Pane \
select-pane \; \
copy-mode -M \; \
send-keys -X select-word \; \
send-keys -X copy-pipe-no-clear "xclip -in -sel primary"
# Triple LMB Select & Copy (Line)
bind-key -T copy-mode-vi TripleClick1Pane \
select-pane \; \
send-keys -X select-line \; \
send-keys -X copy-pipe-no-clear "xclip -in -sel primary"
bind-key -n TripleClick1Pane \
select-pane \; \
copy-mode -M \; \
send-keys -X select-line \; \
send-keys -X copy-pipe-no-clear "xclip -in -sel primary"
If you don't use copy-mode-vi, replace this with copy-mode.
For older tmux versions check the edit-history.
In Alacrity holding Shift allows copying as if there's no tmux.
source
Building off of #ideasman42 's answer. This is using tmux 2.8 and pbcopy for macos mojave.
# Double LMB Select & Copy (Word)
bind-key -n DoubleClick1Pane \
select-pane \; \
copy-mode -M \; \
send-keys -X select-word \; \
run-shell "sleep .5s" \; \
send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -n DoubleClick1Pane \
select-pane \; \
copy-mode -M \; \
send-keys -X select-word \; \
run-shell "sleep .5s" \;
send-keys -X copy-pipe-and-cancel "pbcopy
My version selects the word, briefly highlights it, copies it to the system buffer and then cancels copy-mode.
I have figured out a copy paste mechanism that is similar of what you will expect form a terminal
I used the following settings to be able to:
select a word with a mouse double click action
select a line with a mouse tripple click action
select a partial line a mouse drag and drop action
This solution will keep the selection highlighted and copy the selection output to both clipboard buffers (primary and clipboard)
When you hit "Enter" you exit and go back to the shell
The advantage here is that you can use both middle mouse button as shift-insert combination outside of tmux to paste the content, while it is still selected.
Also when you exited back to the shell, you can use middle mouse button or hit shift-insert to paste the content
All what you would expect from a normal terminal environment
# Enable mouse control
setw -g mouse on
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter \
send -X cancel
# Drag and Drop Aelect & Copy (Selection)
bind-key -T copy-mode-vi MouseDragEnd1Pane \
send-keys -X copy-pipe "xclip -in -f | xclip -in -sel c" \; \
send-keys -X no-clear
# Double LMB Select & Copy (Word)
bind-key -T copy-mode-vi DoubleClick1Pane \
select-pane \; \
send-keys -X select-word \; \
send-keys -X copy-pipe "xclip -in -f | xclip -in -sel c" \; \
send-keys -X no-clear
bind-key -n DoubleClick1Pane \
select-pane \; \
copy-mode -M \; \
send-keys -X select-word \; \
send-keys -X copy-pipe "xclip -in -f | xclip -in -sel c" \; \
send-keys -X no-clear
# Triple LMB Select & Copy (Line)
bind-key -T copy-mode-vi TripleClick1Pane \
select-pane \; \
send-keys -X select-line \; \
send-keys -X copy-pipe "xclip -in -f | xclip -in -sel c" \; \
send-keys -X no-clear
bind-key -n TripleClick1Pane \
select-pane \; \
copy-mode -M \; \
send-keys -X select-line \; \
send-keys -X copy-pipe "xclip -in -f | xclip -in -sel c" \; \
send-keys -X no-clear
# Middle click to paste from the primary buffer
unbind-key MouseDown2Pane
bind-key -n MouseDown2Pane run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer"
# Shift insert to paste from the clipboard
unbind-key S-IC
bind-key S-IC run "tmux set-buffer \"$(xclip -o -sel c)\"; tmux paste-buffer"
NOTE1 : in order for this to work across a ssh session : -X has to be provided as option to ssh
NOTE2: I'm using tmux version 2.8
On Kitty/Alacritty, we double-click on the text-block while keeping Shift pressed. And copying works fine natively as well as within tmux.
Just uncheck the "Enable mouse reporting" option in iTerm2.
But this has side effect: set -g mouse on in ~/.tmux.conf will not work.