Java 调用命令行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Test05 {
public static void main(String[] args) {
String cmd = "calc";
try {
Process ps = Runtime.getRuntime().exec(cmd);//打开计算器
// ps.getInputStream() 获取进程的输出流
BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
String line;
while((line = br.readLine()) != null) {
System.out.println(line);
}
}catch(Exception e) {
e.printStackTrace();
}
}
}

elastix 使用

  1. 下载 elastix-5.1.0-win64,解压后得到elastix.exetransformix.exe
  2. 下载 elastix 用户手册
  3. 命令行调用elastix.exetransformix.exe得到配准后的脑片
    1
    2
    3
    4
    5
    6
    elastix.exe --help
    elastix -f input/downSampleImage.tif -m input/tempImage.tif -out output -p input/Parameters_BSpline.txt

    transformix.exe --help
    transformix -in input/annotationImage.tif -out result -tp output/TransformParameters.0.txt
    # 参数文件中可以设置输出格式,默认为mhd,此处修改为tif

ImageJ 合并通道

  1. 将待合并的两张图像载入ImageJ
  2. Image→Color→Merge Channels
  3. 脑片保留红色通道,脑区轮廓保留绿色通道(注意不要勾选create composite,以免保存时仅有最上层的通道)
    合并通道
  4. 保存为tif文件合并后的图像

二维脑片配准关键步骤

  1. 定位与脑片最匹配的图谱(相似度最高)
  2. 获取Allen全脑平均模板tempImage和对应的注释文件annotationImage
  3. 通过elastix.exetransformix.exe对脑片配准(模板→脑片 注释→脑片)
  4. 根据注释文件获取脑区轮廓lineImage
  5. 轮廓与脑片合并得到fuseImage
  6. 根据annotationImage的像素值匹配脑区
  7. 脑区细胞计数
    二维脑片配准流程图

今日总结

到目前为止感觉BIRDS的配准是通过elastix实现的,需要看一下elastix的论文,然后试一下elastix进行脑片配准的效果。

不管老板对我的要求是怎样的,我对自己的要求就是把一个小项目做完再做下一个小项目,不能三心二意。我的课题要根据我自己的兴趣来,广泛涉猎给自己找一条出路,我现在没有能力回绝老板的各种要求就是因为我没有能够给出其他方案,要行动起来。

每天拿出1~2个小时跟着吴思老师实验室出的书《神经计算建模实战——基于brainpy》实操一下,总要下点功夫入门计算神经科学吧!可能需要补一下微积分的知识😎

参考文章