This file contains hidden or 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
    
  
  
    
  | //g++ read_nifti.cpp -O3 -std=c++17 `pkg-config opencv --cflags --libs` -o read_nifti | |
| #include <iostream> | |
| #include <fstream> | |
| #include <vector> | |
| #include <opencv2/opencv.hpp> | |
| #include <memory> | |
| template < typename dtype > | 
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
  
    
      This file contains hidden or 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
    
  
  
    
  | class UnionFind: | |
| """Weighted quick-union with path compression and connected components. | |
| The original Java implementation is introduced at | |
| https://www.cs.princeton.edu/~rs/AlgsDS07/01UnionFind.pdf | |
| >>> uf = UnionFind(10) | |
| >>> for (p, q) in [(3, 4), (4, 9), (8, 0), (2, 3), (5, 6), (5, 9), | |
| ... (7, 3), (4, 8), (6, 1)]: | |
| ... uf.union(p, q) |