本文整理汇总了Java中ij.io.FileInfo.GRAY8属性的典型用法代码示例。如果您正苦于以下问题:Java FileInfo.GRAY8属性的具体用法?Java FileInfo.GRAY8怎么用?Java FileInfo.GRAY8使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类ij.io.FileInfo
的用法示例。
在下文中一共展示了FileInfo.GRAY8属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: imgType
public static String imgType(int fiType) {
switch (fiType) {
case FileInfo.GRAY32_FLOAT:
return "float";
case FileInfo.GRAY32_INT:
return "int32";
case FileInfo.GRAY32_UNSIGNED:
return "uint32";
case FileInfo.GRAY16_SIGNED:
return "int16";
case FileInfo.GRAY16_UNSIGNED:
return "uint16";
case FileInfo.COLOR8:
case FileInfo.GRAY8:
return "uint8";
default:
return "unsupported";
}
}
示例2: getHeaderInfo
/**
* Reads the header information from the file into a fileinfo object
* @param filename the filename
* @return the FileInfo
* @throws IOException
*/
public FileInfo getHeaderInfo( String filename ) throws IOException {
if (IJ.debugMode) CONRAD.log("Entering Nrrd_Reader.readHeader():");
FileInfo fi = new FileInfo();
File file = new File(filename);
fi.fileName=file.getName();
fi.directory = file.getParent() + "/";
// NB Need RAF in order to ensure that we know file offset
RandomAccessFile input = new RandomAccessFile(fi.directory+fi.fileName,"r");
fi.fileType = FileInfo.GRAY8; // just assume this for the mo
fi.fileFormat = FileInfo.RAW;
fi.nImages = 1;
byte [] header = new byte [6];
input.read(header);
fi.width = (int) convertToUnsignedShort(header, 0);
fi.height = (int) convertToUnsignedShort(header, 1);
fi.nImages = (int) convertToUnsignedShort(header, 2);
CONRAD.log("Dennerlein Reading image with " + fi.nImages + " frames with " + fi.width + "x" + fi.height + " resolution");
fi.compression = FileInfo.COMPRESSION_NONE;
fi.fileType=FileInfo.GRAY32_FLOAT;
// exception for projection matrix data
if (fi.width == 3 && fi.height == 4){
fi.width = 4;
fi.height = 3;
fi.fileType=FileInfo.GRAY64_FLOAT;
}
if (fi.width == 4 && fi.height == 3){
fi.fileType=FileInfo.GRAY64_FLOAT;
}
fi.offset = 6;
fi.intelByteOrder = true;
input.close();
return (fi);
}
示例3: getFileInfo
public FileInfo getFileInfo(){
FileInfo fi = new FileInfo();
fi.fileFormat = FileInfo.RAW;
fi.fileType = FileInfo.GRAY8;
fi.height = Integer.parseInt(this.jTextFieldHeight.getText());
fi.width = Integer.parseInt(this.jTextFieldWidth.getText());
fi.nImages = Integer.parseInt(this.jTextFieldStack.getText());
fi.offset = Integer.parseInt(getJOffset().getText());
if (this.jButtonBig.isSelected()){
fi.intelByteOrder = false;
}
if (this.jButtonLittle.isSelected()){
fi.intelByteOrder = true;
}
if (this.jButtonShort.isSelected()){
fi.fileType=FileInfo.GRAY16_UNSIGNED;
}
if (this.jButtonSShort.isSelected()){
fi.fileType=FileInfo.GRAY16_SIGNED;
}
if (this.jButtonFloat.isSelected()){
fi.fileType=FileInfo.GRAY32_FLOAT;
}
if (this.jButtonDouble.isSelected()){
fi.fileType=FileInfo.GRAY64_FLOAT;
}
return fi;
}
示例4: getHeaderInfo
/**
* Reads the header information from the file into a fileinfo object
* @param filename the filename
* @return the FileInfo
* @throws IOException
*/
public FileInfo getHeaderInfo( String filename ) throws IOException {
if (IJ.debugMode) CONRAD.log("Entering Nrrd_Reader.readHeader():");
FileInfo fi = new FileInfo();
File file = new File(filename);
fi.fileName=file.getName();
fi.directory = file.getParent() + "/";
// NB Need RAF in order to ensure that we know file offset
RandomAccessFile input = new RandomAccessFile(fi.directory+fi.fileName,"r");
fi.fileType = FileInfo.GRAY8; // just assume this for the mo
fi.fileFormat = FileInfo.RAW;
fi.nImages = 1;
// parse the header file, until reach an empty line// boolean keepReading=true;
byte [] values = new byte[4];
input.read(values);
fi.offset = (int) convertToUnsignedInt(values,0);
//System.out.println("Read " + fi.offset);
if (fi.offset != 2048){
throw new IOException("Wrong Header Size; Not an SEQ File.");
}
byte [] header = new byte [(fi.offset) -4];
input.read(header);
fi.width = (int) convertToUnsignedInt(header, 3);
fi.height = (int) convertToUnsignedInt(header, 4);
fi.nImages = (int) convertToUnsignedInt(header, 6);
if (true) {
System.out.println("SEQ Reading image with " + fi.nImages + " frames with " + fi.width + "x" + fi.height + " resolution");
}
int dataType = (int) convertToUnsignedInt(header, 458);
if((dataType & 512)>0){
fi.compression = FileInfo.COMPRESSION_UNKNOWN;
}
else {
fi.compression = FileInfo.COMPRESSION_NONE;
}
fi.fileType=FileInfo.GRAY16_UNSIGNED;
fi.intelByteOrder = true;
input.close();
return (fi);
}