public class MultiFrameImageFactory
extends java.lang.Object
A class to create a set of instances, which when given unenhanced ("classic") images creates one or more enhanced multiframe image instances from them where possible, otherwise leaves them alone but includes them in the set.
Each enhanced image corresponds to one FrameSet
.
Modifier and Type | Field and Description |
---|---|
protected static int |
nextStackID |
Constructor and Description |
---|
MultiFrameImageFactory() |
Modifier and Type | Method and Description |
---|---|
static void |
addStack(AttributeList list,
java.util.Map<java.lang.String,com.pixelmed.dicom.StackOfSlices> stacks) |
static void |
addStackIfNotAlreadyPresent(AttributeList list,
java.util.Map<java.lang.String,com.pixelmed.dicom.StackOfSlices> stacks) |
static java.lang.String |
chooseAppropriateConvertedSOPClassUID(AttributeList list)
Given the Attributes of a "classic" single frame instance, choose an appropriate multi-frame (enhanced) image SOP Class to convert it to.
|
static java.io.File[] |
convertImages(java.io.File[] files,
java.io.File outputFolder)
Create a new set of instances, converting to enhanced images when possible, from a set of DICOM files.
|
static java.io.File[] |
convertImages(java.util.Set<java.io.File> files,
java.io.File outputFolder)
Create a new set of instances, converting to enhanced images when possible, from a set of DICOM files.
|
static java.io.File[] |
convertImages(java.lang.String[] inputPaths,
java.lang.String outputPath)
Create a new set of instances, converting to enhanced images when possible, from a set of DICOM files.
|
static java.io.File |
createEnhancedImageFromFrameSet(FrameSet frameSet,
java.io.File outputFolder,
java.util.Map<java.lang.String,java.io.File> filesBySOPInstanceUID,
java.util.Map<java.lang.String,HierarchicalImageReference> multiFrameReferenceBySingleFrameUID)
Create an enhanced image from a set of DICOM single image files in a FrameSet.
|
static java.io.File |
createEnhancedImageFromFrameSet(FrameSet frameSet,
java.io.File outputFolder,
java.util.Map<java.lang.String,java.io.File> filesBySOPInstanceUID,
java.util.Map<java.lang.String,HierarchicalImageReference> multiFrameReferenceBySingleFrameUID,
java.util.Map<java.lang.String,com.pixelmed.dicom.StackOfSlices> stacks)
Create an enhanced image from a set of DICOM single image files in a FrameSet.
|
static AttributeList |
createEnhancedImageFromFrameSet(FrameSet frameSet,
java.util.Map<java.lang.String,java.io.File> filesBySOPInstanceUID,
java.util.Map<java.lang.String,AttributeList> listsBySOPInstanceUID,
java.util.Map<java.lang.String,HierarchicalImageReference> multiFrameReferenceBySingleFrameUID)
Create an enhanced image from a set of DICOM single image files or
AttributeList s in a FrameSet. |
static AttributeList |
createEnhancedImageFromFrameSet(FrameSet frameSet,
java.util.Map<java.lang.String,java.io.File> filesBySOPInstanceUID,
java.util.Map<java.lang.String,AttributeList> listsBySOPInstanceUID,
java.util.Map<java.lang.String,HierarchicalImageReference> multiFrameReferenceBySingleFrameUID,
java.util.Map<java.lang.String,com.pixelmed.dicom.StackOfSlices> stacks)
Create an enhanced image from a set of DICOM single image files or
AttributeList s in a FrameSet. |
static void |
main(java.lang.String[] arg)
For testing, read all DICOM files and convert them to enhanced images when possible.
|
public static java.lang.String chooseAppropriateConvertedSOPClassUID(AttributeList list)
Given the Attributes of a "classic" single frame instance, choose an appropriate multi-frame (enhanced) image SOP Class to convert it to.
If nothing modality-specific is found, default to multi-frame secondary capture if the Pixel Data characteristics are appropriate,
otherwise in the worst case the SOPClass.RawDataStorage
is returned.
list
- the attributes of the single frame instancepublic static void addStack(AttributeList list, java.util.Map<java.lang.String,com.pixelmed.dicom.StackOfSlices> stacks)
public static void addStackIfNotAlreadyPresent(AttributeList list, java.util.Map<java.lang.String,com.pixelmed.dicom.StackOfSlices> stacks)
public static AttributeList createEnhancedImageFromFrameSet(FrameSet frameSet, java.util.Map<java.lang.String,java.io.File> filesBySOPInstanceUID, java.util.Map<java.lang.String,AttributeList> listsBySOPInstanceUID, java.util.Map<java.lang.String,HierarchicalImageReference> multiFrameReferenceBySingleFrameUID, java.util.Map<java.lang.String,com.pixelmed.dicom.StackOfSlices> stacks) throws DicomException, java.io.IOException
Create an enhanced image from a set of DICOM single image files or AttributeList
s in a FrameSet.
frameSet
- an existing set of frames (single images) to convert that have already been determined to be a FrameSetfilesBySOPInstanceUID
- an existing map of the SOP Instance UIDs of the single images to the files that contain them (null if listsBySOPInstanceUID supplied)listsBySOPInstanceUID
- an existing map of the SOP Instance UIDs of the single images to the AttributeList
s that contain them (null if filesBySOPInstanceUID supplied)multiFrameReferenceBySingleFrameUID
- an existing (possibly empty) map to which is added mappings from each single frame SOP Instance UIDs to converted UIDs + frame number referencesstacks
- an existing (possibly empty) set of stacks from other FrameSets, which will be extended or re-used if a stack is foundDicomException
- if an input file cannot be found for a frame, or it cannot be parsedjava.io.IOException
- if an input file cannot be readpublic static AttributeList createEnhancedImageFromFrameSet(FrameSet frameSet, java.util.Map<java.lang.String,java.io.File> filesBySOPInstanceUID, java.util.Map<java.lang.String,AttributeList> listsBySOPInstanceUID, java.util.Map<java.lang.String,HierarchicalImageReference> multiFrameReferenceBySingleFrameUID) throws DicomException, java.io.IOException
Create an enhanced image from a set of DICOM single image files or AttributeList
s in a FrameSet.
frameSet
- an existing set of frames (single images) to convert that have already been determined to be a FrameSetfilesBySOPInstanceUID
- an existing map of the SOP Instance UIDs of the single images to the files that contain them (null if listsBySOPInstanceUID supplied)listsBySOPInstanceUID
- an existing map of the SOP Instance UIDs of the single images to the AttributeList
s that contain them (null if filesBySOPInstanceUID supplied)multiFrameReferenceBySingleFrameUID
- an existing (possibly empty) map to which is added mappings from each single frame SOP Instance UIDs to converted UIDs + frame number referencesDicomException
- if an input file cannot be found for a frame, or it cannot be parsedjava.io.IOException
- if an input file cannot be readpublic static java.io.File createEnhancedImageFromFrameSet(FrameSet frameSet, java.io.File outputFolder, java.util.Map<java.lang.String,java.io.File> filesBySOPInstanceUID, java.util.Map<java.lang.String,HierarchicalImageReference> multiFrameReferenceBySingleFrameUID, java.util.Map<java.lang.String,com.pixelmed.dicom.StackOfSlices> stacks) throws DicomException, java.io.IOException
Create an enhanced image from a set of DICOM single image files in a FrameSet.
frameSet
- an existing set of frames (single images) to convert that have already been determined to be a FrameSetoutputFolder
- a folder in which to store converted files (which must already exist)filesBySOPInstanceUID
- an existing map of the SOP Instance UIDs of the single images to the files that contain themmultiFrameReferenceBySingleFrameUID
- an existing (possibly empty) map to which is added mappings from each single frame SOP Instance UIDs to converted UIDs + frame number referencesstacks
- an existing (possibly empty) set of stacks from other FrameSets, which will be extended or re-used if a stack is foundDicomException
- if an input file cannot be found for a frame, or it cannot be parsedjava.io.IOException
- if an input file cannot be readpublic static java.io.File createEnhancedImageFromFrameSet(FrameSet frameSet, java.io.File outputFolder, java.util.Map<java.lang.String,java.io.File> filesBySOPInstanceUID, java.util.Map<java.lang.String,HierarchicalImageReference> multiFrameReferenceBySingleFrameUID) throws DicomException, java.io.IOException
Create an enhanced image from a set of DICOM single image files in a FrameSet.
frameSet
- an existing set of frames (single images) to convert that have already been determined to be a FrameSetoutputFolder
- a folder in which to store converted files (which must already exist)filesBySOPInstanceUID
- an existing map of the SOP Instance UIDs of the single images to the files that contain themmultiFrameReferenceBySingleFrameUID
- an existing (possibly empty) map to which is added mappings from each single frame SOP Instance UIDs to converted UIDs + frame number referencesDicomException
- if an input file cannot be found for a frame, or it cannot be parsedjava.io.IOException
- if an input file cannot be readpublic static java.io.File[] convertImages(java.util.Set<java.io.File> files, java.io.File outputFolder) throws DicomException, java.io.IOException
Create a new set of instances, converting to enhanced images when possible, from a set of DICOM files.
Non-DICOM files and problems parsing files are ignored, rather than causing failure
files
- a set of files (not folders) to convertoutputFolder
- a folder in which to store converted files (which must already exist)DicomException
- if folder in which to store converted files does not existjava.io.IOException
- if an input file cannot be readpublic static java.io.File[] convertImages(java.io.File[] files, java.io.File outputFolder) throws DicomException, java.io.IOException
Create a new set of instances, converting to enhanced images when possible, from a set of DICOM files.
Non-DICOM files and problems parsing files are ignored, rather than causing failure
files
- an array of files (not folders) to convertoutputFolder
- a folder in which to store converted files (which must already exist)DicomException
- if folder in which to store converted files does not existjava.io.IOException
- if an input file cannot be readpublic static java.io.File[] convertImages(java.lang.String[] inputPaths, java.lang.String outputPath) throws DicomException, java.io.IOException
Create a new set of instances, converting to enhanced images when possible, from a set of DICOM files.
Non-DICOM files and problems parsing files are ignored, rather than causing failure
inputPaths
- a set of paths of filenames and/or folder names of files containing the images to convertoutputPath
- a path in which to store converted files (which must already exist)DicomException
- if folder in which to store converted files does not existjava.io.IOException
- if an input file cannot be readpublic static void main(java.lang.String[] arg)
For testing, read all DICOM files and convert them to enhanced images when possible.
arg
- the filenames and/or folder names of files containing the images to partition, followed by the path in which to store the converted instances