当前位置: 首页>>代码示例>>Java>>正文


Java FileInfo.RAW属性代码示例

本文整理汇总了Java中ij.io.FileInfo.RAW属性的典型用法代码示例。如果您正苦于以下问题:Java FileInfo.RAW属性的具体用法?Java FileInfo.RAW怎么用?Java FileInfo.RAW使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在ij.io.FileInfo的用法示例。


在下文中一共展示了FileInfo.RAW属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fileInfo

private void fileInfo() {
	FileInfo fi = new FileInfo();
	try {
		fi = this.getFileInfo();
	} catch (final NullPointerException npe) {
	}
	fi.pixelWidth = VoxelSize;
	fi.pixelHeight = VoxelSize;
	fi.width = PicMatrixX;
	fi.height = PicMatrixY;
	fi.valueUnit = "mm";
	fi.fileName = fileName;
	fi.info = properties;
	fi.fileFormat = FileInfo.RAW;
	fi.compression = FileInfo.COMPRESSION_NONE;
	fi.fileType = FileInfo.GRAY16_SIGNED; //
	this.setFileInfo(fi);
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:18,代码来源:Read_Stratec_File.java

示例2: writeRawImage

private static void writeRawImage(final ImagePlus imp, final FileOutputStream fileOutputStream) throws MiException {
    final FileInfo fileInfo = imp.getFileInfo();
    fileInfo.fileFormat = FileInfo.RAW;
    // Eric Nodwell:
    // The following line is basically a bug work-around as far as I can
    // tell, as getFileInfo() ought to set virtualStack if the ImagePlus
    // is a VirtualStack.  In 1.44 it does not.
    final ImageStack imageStack = imp.getStack();
    if (imageStack.isVirtual() && imageStack instanceof VirtualStack) {
        fileInfo.virtualStack = (VirtualStack) imp.getStack();
    }

    try {
        final ImageWriter imageWriter = new ImageWriter(fileInfo);
        imageWriter.write(fileOutputStream);
    } catch (final IOException ex) {
        throw new MiException(ex);
    }
}
 
开发者ID:ij-plugins,项目名称:ijp-toolkit,代码行数:19,代码来源:MiEncoder.java

示例3: main

public static void main(String[] args) {
	new ImageJ();
	FileInfo fI = new FileInfo();
	fI.fileFormat = FileInfo.RAW;
	fI.fileType = FileInfo.GRAY16_UNSIGNED;
	fI.height = 256;
	fI.width = 256;
	fI.nImages = 256;
	fI.intelByteOrder = true;
	
	fI.directory = args[0];
	fI.fileName = args[1];		
	
	FileOpener fO = new FileOpener(fI);
			
	Grid3D grid = ImageUtil.wrapImagePlus(fO.open(false));
	
	NumericPointwiseIteratorND pIter = new NumericPointwiseIteratorND(grid);
	while (pIter.hasNext())
	{
		if ( pIter.get() == 0 )
		{
			pIter.getNext();
		} else {
			pIter.setNext(1000+pIter.get());
		}
			
	}
	grid.show("Skull");
   
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:31,代码来源:ReadImageDataFromFileExample.java

示例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;

	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);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:44,代码来源:DennerleinProjectionSource.java

示例5: getDefaultFloat32LittleEndianFileInfo

/**
 * The default float 32, little endian format for CONRAD.
 * @return the FileInfo object
 */
public static FileInfo getDefaultFloat32LittleEndianFileInfo(){
	FileInfo fI = new FileInfo();
	fI.fileFormat = FileInfo.RAW;
	fI.fileType = FileInfo.GRAY32_FLOAT;
	fI.height = 256;
	fI.width = 256;
	fI.nImages = 1;
	fI.intelByteOrder = true;
	fI.directory = "";
	fI.fileName = "";
	return fI;
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:16,代码来源:GridRawIOUtil.java

示例6: getDefaultFloat32BigEndianFileInfo

/**
 * The default float 32, big endian format for CONRAD.
 * @return the FileInfo object
 */
public static FileInfo getDefaultFloat32BigEndianFileInfo(){
	FileInfo fI = new FileInfo();
	fI.fileFormat = FileInfo.RAW;
	fI.fileType = FileInfo.GRAY32_FLOAT;
	fI.height = 256;
	fI.width = 256;
	fI.nImages = 1;
	fI.intelByteOrder = false;
	fI.directory = "";
	fI.fileName = "";
	return fI;
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:16,代码来源:GridRawIOUtil.java

示例7: 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;
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:28,代码来源:RawDataOpener.java

示例8: 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 MKT_Reader.getHeaderInfo():");
	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
	fi.fileType = FileInfo.GRAY16_SIGNED;  // just assume this for the mo    
	fi.fileFormat = FileInfo.RAW;
	fi.nImages = 1;
	// read header info
	FileInputStream fis = new FileInputStream(file);
	byte [] unknownHeader = new byte[10];
	byte [] size = new byte[4];
	fis.read(unknownHeader);
	fis.read(size);
	long sizeInByte = ByteBuffer.wrap(size).getInt();
	fis.close();
	fi.offset = 16;
	fi.gapBetweenImages=32;
	//System.out.println("Read " + fi.offset);
	if (fi.offset != 16){
		throw new IOException("Wrong Header Size; Not an MKT File.");
	}
	fi.width = 576;
	if((sizeInByte/(2*fi.width))%2!=0){
		fi.width=512;
		fi.height = (int) (sizeInByte/(2*fi.width));
	} else {
		fi.height = (int) (sizeInByte/(2*fi.width));
	}
	
	/* Here we had a look at the 16 byte header and this is what we found so far:
	 * Width	Height	Size	Size (Byte)	Found	Size B Hex
	 * 576		580		334080	668160		320A	A3200
	 * 576		578		332928	665856		290A	A2900
	 * 576		576		331776	663552		200A	A2000
	 * 512		512		262144	524288		0008	80000
	*/
	fi.nImages = 1204;

	if (true) {
		System.out.println("MTK Reading image with " + fi.nImages + " frames with " + fi.width + "x" + fi.height + " resolution");
	}
	fi.compression = FileInfo.COMPRESSION_NONE;
	
	fi.intelByteOrder = true;

	return (fi);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:56,代码来源:MKTProjectionSource.java

示例9: 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);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:51,代码来源:SEQProjectionSource.java


注:本文中的ij.io.FileInfo.RAW属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。