import org.itk.simple.*;
public class DicomSeriesReader {
public static void main(String[] args) {
if (args.length < 2) {
System.out.println("Usage: DicomSeriesReader <input_directory> <output_file>");
System.exit(1);
}
System.out.println("Reading Dicom directory: " + args[0]);
ImageSeriesReader imageSeriesReader = new ImageSeriesReader();
final VectorString dicomNames = ImageSeriesReader.getGDCMSeriesFileNames(args[0]);
imageSeriesReader.setFileNames(dicomNames);
Image image = imageSeriesReader.execute();
VectorUInt32 size = image.getSize();
System.out.println("Image size: " + size.get(0) + " " + size.get(1) + " " + size.get(2));
System.out.println("Writing " + args[1]);
SimpleITK.writeImage(image, args[1]);
}
}