我正在使用ImageJ构建一个显示dicom Image的java应用程序。 我能够导入dicom图像并成功显示它。但是,我想要显示图像的冠状和矢状视图。 这可能使用ImageJ吗? 使用applet显示dicom图像的代码就是我在下面的内容:
// SimpleFileChooser.java
// A simple file chooser to see what it takes to make one of these work.
//
import static com.sun.org.apache.xerces.internal.util.PropertyState.is;
import ij.plugin.DICOM;
import java.applet.Applet;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
public class readDicom extends Applet {
public void init() {
setSize(350, 200);
JButton openButton = new JButton("Open");
final JLabel statusbar
= new JLabel("Output of your selection will go here");
// Create a file chooser that opens up as an Open dialog
openButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
try {
JFileChooser chooser = new JFileChooser();
chooser.setMultiSelectionEnabled(true);
int option = chooser.showOpenDialog(readDicom.this);
if (option == JFileChooser.APPROVE_OPTION) {
File[] sf = chooser.getSelectedFiles();
String filelist = " ";
filelist = sf[0].getName();
File file = chooser.getCurrentDirectory();
String fullpath = file.getCanonicalPath();
fullpath = fullpath + "\\" + filelist;
InputStream reader = new FileInputStream(fullpath);
DICOM dcm = new DICOM(reader);
dcm.run("Name");
dcm.show();
for (int i = 1; i < sf.length; i++) {
filelist += ", " + sf[i].getName();
}
statusbar.setText("You chose " + filelist);
} else {
statusbar.setText("You canceled.");
}
} catch (Exception exception) {
exception.printStackTrace();
}
}
});
this.add(openButton);
this.add(statusbar);
}
}
答案 0 :(得分:1)
ImageJ中的Image > Stacks > Orthogonal Views命令可以满足您的需求。如果您想使用其API,请查看source code或javadoc。