// invert binary tree : (right node >> left node && left node >> right node )
const invertTree =(root)=>{
if(root===null) return root;
let queue =[root] ;
while(queue.length>0){
let node =queue.shift() ;
if(node !=null){
let hold = node.left ;
node.left =node.right;
node.right =hold ;
if(node.left) queue.push(node.left) ;
if(node.right) queue.push(node.right) ;
}
}
return root;
}
#!/bin/sh
# Make an inverse binary image mask (switch the 1s and 0’s)
# Create the inverse mask (Mark Jenkinson's approach. Very clever:
# Multiply by negative 1, then add 1). Make sure you pass in a binary mask)
fslmaths mask -mul -1 -add 1 -bin mask_inverse
# OR use -binv flag
fslmaths mask -binv mask_inverse