public class DicomWriter extends FormatWriter implements IExtraMetadataWriter
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
DicomWriter.PlaneOffset |
(package private) class |
DicomWriter.UIDCreator
Helper class for creating UIDs.
|
| Modifier and Type | Field and Description |
|---|---|
private int |
baseTileHeight |
private int |
baseTileWidth |
private boolean |
bigTiff |
private long[] |
compressionMethodPointer |
private java.lang.Integer |
currentPlane |
private long |
fileMetaLengthPointer |
private IFD[][] |
ifds |
private java.lang.String |
implementationUID |
private java.lang.String |
instanceUIDValue |
private long[] |
nextIFDPointer |
private long[] |
pixelDataLengthPointer |
private int[] |
pixelDataSize |
private DicomWriter.PlaneOffset[][] |
planeOffsets |
private static java.lang.String |
SOP_CLASS_UID_VALUE |
private java.util.ArrayList<ITagProvider> |
tagProviders |
static java.lang.String |
TIFF_KEY
Option for turning off TIFF metadata.
|
private TiffSaver |
tiffSaver |
private int[] |
tileHeight |
private int[] |
tileWidth |
private long[] |
transferSyntaxPointer |
static java.lang.String |
UID_DEFAULT_ROOT |
static java.lang.String |
UID_ROOT_KEY
Option for setting the organization root for UIDs.
|
private DicomWriter.UIDCreator |
uids |
private java.lang.Boolean |
validPixelCount |
cm, compression, compressionTypes, fps, initialized, interleaved, metadataRetrieve, options, out, resolution, resolutionData, sequential, series, validBitsCOMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixes| Constructor and Description |
|---|
DicomWriter() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canDoStacks()
Reports whether the writer can save multiple images to a single file.
|
private void |
checkPixelCount(boolean warn) |
private void |
checkPrecompressedSupport()
Check if pre-compressed tiles are supported with the current options.
|
void |
close() |
Codec |
getCodec() |
private java.lang.String |
getCompressionMethod() |
private java.lang.String |
getFilename(int pyramid,
int res) |
private java.lang.String |
getImageType(java.lang.String pyramidName,
int res,
boolean hasPyramid,
int resolutionCount) |
private int |
getIndex(int pyramid,
int res) |
private TiffRational |
getPhysicalSize(ome.units.quantity.Length size) |
int[] |
getPixelTypes(java.lang.String codec)
Gets the supported pixel types for the given codec.
|
private int |
getStoredLength(DicomTag tag) |
private TiffCompression |
getTIFFCompression() |
int |
getTileSizeX()
Retrieves the current tile width
Defaults to 0 if not supported
|
int |
getTileSizeY()
Retrieves the current tile height
Defaults to 0 if not supported
|
private java.lang.String |
getTransferSyntax() |
java.lang.String |
getUIDRoot() |
private int[] |
getZCTCoords(int no) |
private boolean |
isReallySequential() |
private DicomTag |
lookupTag(java.util.List<DicomTag> tags,
DicomTag compare) |
private DicomTag |
makeItem() |
private DicomTag |
makeItemDelimitation() |
private short[] |
makeShortArray(int v) |
private void |
openFile(int pyramid,
int res) |
private java.lang.String |
padString(java.lang.String value)
Pad the given string so that the length is a multiple of 2.
|
private java.lang.String |
padString(java.lang.String value,
java.lang.String append) |
private void |
padTagValues(DicomTag t) |
private java.lang.String |
padUID(java.lang.String value)
Pad the given string so that the length is a multiple of 2.
|
void |
saveBytes(int no,
byte[] buf,
int x,
int y,
int w,
int h)
Saves the given image tile to the current series in the current file.
|
void |
saveCompressedBytes(int no,
byte[] buf,
int x,
int y,
int w,
int h)
Save a compressed tile to the current output file.
|
void |
setBigTiff(boolean bigTiff)
Sets whether or not BigTIFF files should be written.
|
void |
setExtraMetadata(java.lang.String tagSource)
Provide additional metadata that should be written
as part of this dataset.
|
void |
setId(java.lang.String id)
Initializes a writer from the input file name.
|
void |
setResolution(int r)
Set the resolution level.
|
void |
setSeries(int s)
Sets the current series.
|
int |
setTileSizeX(int tileSize)
Will attempt to set the tile width to the desired value and return the actual value which will be used
|
int |
setTileSizeY(int tileSize)
Will attempt to set the tile height to the desired value and return the actual value which will be used
|
boolean |
writeDualPersonality()
Checks the writer's associated MetadataOptions to see
if dual personality writing has been explicitly enabled
or disabled.
|
private void |
writeHeader()
Write the preamble, prefix, and file meta elements.
|
private void |
writeIFDs(int resIndex) |
private void |
writeTag(DicomTag tag) |
changeOutputFile, checkParams, createOutputStream, getCodecOptions, getColorModel, getCompression, getCompressionTypes, getFramesPerSecond, getMetadataRetrieve, getPixelTypes, getPlaneCount, getPlaneCount, getResolution, getResolutionCount, getResolutions, getSamplesPerPixel, getSamplesPerPixel, getSeries, getSizeX, getSizeY, hasResolutions, isFullPlane, isInterleaved, isSupportedType, saveBytes, saveBytes, savePlane, savePlane, savePlane, seekToPlaneOffset, setCodecOptions, setColorModel, setCompression, setFramesPerSecond, setInterleaved, setMetadataRetrieve, setResolutions, setValidBitsPerPixel, setWriteSequentiallycheckSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, isThisType, setMetadataOptionsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFormat, getNativeDataType, getSuffixes, isThisTypegetMetadataOptions, getSupportedMetadataLevels, setMetadataOptionspublic static final java.lang.String UID_ROOT_KEY
public static final java.lang.String UID_DEFAULT_ROOT
public static final java.lang.String TIFF_KEY
private static final java.lang.String SOP_CLASS_UID_VALUE
private long[] pixelDataLengthPointer
private int[] pixelDataSize
private long[] transferSyntaxPointer
private long[] compressionMethodPointer
private long[] nextIFDPointer
private IFD[][] ifds
private long fileMetaLengthPointer
private int baseTileWidth
private int baseTileHeight
private int[] tileWidth
private int[] tileHeight
private DicomWriter.PlaneOffset[][] planeOffsets
private java.lang.Integer currentPlane
private DicomWriter.UIDCreator uids
private java.lang.String instanceUIDValue
private java.lang.String implementationUID
private java.util.ArrayList<ITagProvider> tagProviders
private boolean bigTiff
private TiffSaver tiffSaver
private java.lang.Boolean validPixelCount
public void setExtraMetadata(java.lang.String tagSource)
IExtraMetadataWritersetExtraMetadata in interface IExtraMetadataWriterpublic void setBigTiff(boolean bigTiff)
public boolean writeDualPersonality()
public void setSeries(int s)
throws FormatException
IFormatWritersetSeries in interface IFormatWritersetSeries in class FormatWriters - the series index, starting from 0.FormatException - if the specified series is invalid.public void setResolution(int r)
IPyramidHandlersetResolution in interface IPyramidHandlersetResolution in class FormatWriterIPyramidHandler.getResolutionCount()public Codec getCodec()
getCodec in interface ICompressedTileWriterpublic void saveCompressedBytes(int no,
byte[] buf,
int x,
int y,
int w,
int h)
throws FormatException,
java.io.IOException
ICompressedTileWritersaveCompressedBytes in interface ICompressedTileWriterno - plane indexbuf - compressed tile bytesx - pixel X coordinate of the upper-left corner of the tiley - pixel Y coordinate of the upper-left corner of the tilew - width in pixels of the compressed tileh - height in pixels of the compressed tileFormatExceptionjava.io.IOExceptionpublic void saveBytes(int no,
byte[] buf,
int x,
int y,
int w,
int h)
throws FormatException,
java.io.IOException
IFormatWritersaveBytes in interface IFormatWriterno - the plane index within the series.buf - the byte array that represents the image tile.x - the X coordinate of the upper-left corner of the image tile.y - the Y coordinate of the upper-left corner of the image tile.w - the width (in pixels) of the image tile.h - the height (in pixels) of the image tile.FormatException - if one of the parameters is invalid.java.io.IOException - if there was a problem writing to the file.IFormatWriter.saveBytes(int, byte[], int, int, int, int)public boolean canDoStacks()
IFormatWritercanDoStacks in interface IFormatWritercanDoStacks in class FormatWriterpublic int[] getPixelTypes(java.lang.String codec)
IFormatWritergetPixelTypes in interface IFormatWritergetPixelTypes in class FormatWriterpublic void setId(java.lang.String id)
throws FormatException,
java.io.IOException
FormatWriterRandomAccessOutputStream for the output
file and initializes the metadata for all the series using
FormatWriter.setSeries(int).setId in interface IFormatHandlersetId in class FormatWriterid - a String specifying the path to the fileFormatExceptionjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class FormatWriterjava.io.IOExceptionpublic int setTileSizeX(int tileSize)
throws FormatException
IFormatWritersetTileSizeX in interface IFormatWritersetTileSizeX in class FormatWritertileSize - The tile width you wish to use. Setting to 0 will disable tilingFormatException - Tile size must be greater than or equal to 0 and less than the image widthpublic int getTileSizeX()
IFormatWritergetTileSizeX in interface IFormatWritergetTileSizeX in class FormatWriterpublic int setTileSizeY(int tileSize)
throws FormatException
IFormatWritersetTileSizeY in interface IFormatWritersetTileSizeY in class FormatWritertileSize - The tile height you wish to use. Setting to 0 will disable tilingFormatException - Tile size must be greater than or equal to 0 and less than the image heightpublic int getTileSizeY()
IFormatWritergetTileSizeY in interface IFormatWritergetTileSizeY in class FormatWriterpublic java.lang.String getUIDRoot()
private int getStoredLength(DicomTag tag)
private void writeTag(DicomTag tag) throws java.io.IOException
java.io.IOExceptionprivate java.lang.String padString(java.lang.String value)
value - original stringprivate java.lang.String padUID(java.lang.String value)
value - original stringprivate java.lang.String padString(java.lang.String value,
java.lang.String append)
private java.lang.String getTransferSyntax()
private java.lang.String getCompressionMethod()
private void openFile(int pyramid,
int res)
throws java.io.IOException
java.io.IOExceptionprivate void writeHeader()
throws java.io.IOException
java.io.IOExceptionprivate java.lang.String getFilename(int pyramid,
int res)
private int getIndex(int pyramid,
int res)
private int[] getZCTCoords(int no)
private boolean isReallySequential()
private java.lang.String getImageType(java.lang.String pyramidName,
int res,
boolean hasPyramid,
int resolutionCount)
private void writeIFDs(int resIndex)
throws java.io.IOException
java.io.IOExceptionprivate TiffCompression getTIFFCompression()
private DicomTag makeItem()
private DicomTag makeItemDelimitation()
private void padTagValues(DicomTag t)
private short[] makeShortArray(int v)
private TiffRational getPhysicalSize(ome.units.quantity.Length size)
private void checkPrecompressedSupport()
java.lang.UnsupportedOperationException - if pre-compressed tiles are not supportedprivate void checkPixelCount(boolean warn)
throws FormatException
FormatExceptionCopyright © 2024 Open Microscopy Environment