Class MultiFrameImageFactory
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
.
Files are written in Explicit VR Little Endian Transfer Syntax.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static boolean
protected static int
protected static boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addStack
(AttributeList list, Map<String, com.pixelmed.dicom.StackOfSlices> stacks) static void
addStackIfNotAlreadyPresent
(AttributeList list, Map<String, com.pixelmed.dicom.StackOfSlices> stacks) static String
Given the Attributes of a "classic" single frame instance, choose an appropriate multi-frame (enhanced) image SOP Class to convert it to.static File[]
convertImages
(File[] files, File outputFolder) Create a new set of instances, converting to enhanced images when possible, from a set of DICOM files.static File[]
convertImages
(String[] inputPaths, String outputPath) Create a new set of instances, converting to enhanced images when possible, from a set of DICOM files.static File[]
convertImages
(Set<File> files, File outputFolder) Create a new set of instances, converting to enhanced images when possible, from a set of DICOM files.static File
createEnhancedImageFromFrameSet
(FrameSet frameSet, File outputFolder, Map<String, File> filesBySOPInstanceUID, Map<String, HierarchicalImageReference> multiFrameReferenceBySingleFrameUID, boolean useRandomFrameOrder, boolean doNotEncodeStackInformation) Create an enhanced image from a set of DICOM single image files in a FrameSet.static File
createEnhancedImageFromFrameSet
(FrameSet frameSet, File outputFolder, Map<String, File> filesBySOPInstanceUID, Map<String, HierarchicalImageReference> multiFrameReferenceBySingleFrameUID, Map<String, com.pixelmed.dicom.StackOfSlices> stacks, boolean useRandomFrameOrder, boolean doNotEncodeStackInformation) Create an enhanced image from a set of DICOM single image files in a FrameSet.static AttributeList
createEnhancedImageFromFrameSet
(FrameSet frameSet, Map<String, File> filesBySOPInstanceUID, Map<String, AttributeList> listsBySOPInstanceUID, Map<String, HierarchicalImageReference> multiFrameReferenceBySingleFrameUID, boolean useRandomFrameOrder, boolean doNotEncodeStackInformation) Create an enhanced image from a set of DICOM single image files orAttributeList
s in a FrameSet.static AttributeList
createEnhancedImageFromFrameSet
(FrameSet frameSet, Map<String, File> filesBySOPInstanceUID, Map<String, AttributeList> listsBySOPInstanceUID, Map<String, HierarchicalImageReference> multiFrameReferenceBySingleFrameUID, Map<String, com.pixelmed.dicom.StackOfSlices> stacks, boolean useRandomFrameOrder, boolean doNotEncodeStackInformation) Create an enhanced image from a set of DICOM single image files orAttributeList
s in a FrameSet.static void
For testing, read all DICOM files and convert them to enhanced images when possible.
-
Field Details
-
useRandomFrameOrderOption
protected static boolean useRandomFrameOrderOption -
doNotEncodeStackInformationOption
protected static boolean doNotEncodeStackInformationOption -
nextStackID
protected static int nextStackID
-
-
Constructor Details
-
MultiFrameImageFactory
public MultiFrameImageFactory()
-
-
Method Details
-
chooseAppropriateConvertedSOPClassUID
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.- Parameters:
list
- the attributes of the single frame instance- Returns:
- the SOP Class UID
-
addStack
public static void addStack(AttributeList list, Map<String, com.pixelmed.dicom.StackOfSlices> stacks) -
addStackIfNotAlreadyPresent
public static void addStackIfNotAlreadyPresent(AttributeList list, Map<String, com.pixelmed.dicom.StackOfSlices> stacks) -
createEnhancedImageFromFrameSet
public static AttributeList createEnhancedImageFromFrameSet(FrameSet frameSet, Map<String, File> filesBySOPInstanceUID, Map<String, throws DicomException, IOExceptionAttributeList> listsBySOPInstanceUID, Map<String, HierarchicalImageReference> multiFrameReferenceBySingleFrameUID, Map<String, com.pixelmed.dicom.StackOfSlices> stacks, boolean useRandomFrameOrder, boolean doNotEncodeStackInformation) Create an enhanced image from a set of DICOM single image files or
AttributeList
s in a FrameSet.- Parameters:
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 theAttributeList
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 founduseRandomFrameOrder
- order frames in encoded pixel data in random order rather than by source instance numberdoNotEncodeStackInformation
- do not include stack information in enhanced images even if used for frame order sorting- Returns:
- a list that is an enhanced multiframe image
- Throws:
DicomException
- if an input file cannot be found for a frame, or it cannot be parsedIOException
- if an input file cannot be read
-
createEnhancedImageFromFrameSet
public static AttributeList createEnhancedImageFromFrameSet(FrameSet frameSet, Map<String, File> filesBySOPInstanceUID, Map<String, throws DicomException, IOExceptionAttributeList> listsBySOPInstanceUID, Map<String, HierarchicalImageReference> multiFrameReferenceBySingleFrameUID, boolean useRandomFrameOrder, boolean doNotEncodeStackInformation) Create an enhanced image from a set of DICOM single image files or
AttributeList
s in a FrameSet.Files are written in Explicit VR Little Endian Transfer Syntax.
- Parameters:
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 theAttributeList
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 referencesuseRandomFrameOrder
- order frames in encoded pixel data in random order rather than by source instance numberdoNotEncodeStackInformation
- do not include stack information in enhanced images even if used for frame order sorting- Returns:
- a list that is an enhanced multiframe image
- Throws:
DicomException
- if an input file cannot be found for a frame, or it cannot be parsedIOException
- if an input file cannot be read
-
createEnhancedImageFromFrameSet
public static File createEnhancedImageFromFrameSet(FrameSet frameSet, File outputFolder, Map<String, File> filesBySOPInstanceUID, Map<String, throws DicomException, IOExceptionHierarchicalImageReference> multiFrameReferenceBySingleFrameUID, Map<String, com.pixelmed.dicom.StackOfSlices> stacks, boolean useRandomFrameOrder, boolean doNotEncodeStackInformation) Create an enhanced image from a set of DICOM single image files in a FrameSet.
Files are written in Explicit VR Little Endian Transfer Syntax.
- Parameters:
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 founduseRandomFrameOrder
- order frames in encoded pixel data in random order rather than by source instance numberdoNotEncodeStackInformation
- do not include stack information in enhanced images even if used for frame order sorting- Returns:
- a file that is an enhanced multiframe image that was created
- Throws:
DicomException
- if an input file cannot be found for a frame, or it cannot be parsedIOException
- if an input file cannot be read
-
createEnhancedImageFromFrameSet
public static File createEnhancedImageFromFrameSet(FrameSet frameSet, File outputFolder, Map<String, File> filesBySOPInstanceUID, Map<String, throws DicomException, IOExceptionHierarchicalImageReference> multiFrameReferenceBySingleFrameUID, boolean useRandomFrameOrder, boolean doNotEncodeStackInformation) Create an enhanced image from a set of DICOM single image files in a FrameSet.
Files are written in Explicit VR Little Endian Transfer Syntax.
- Parameters:
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 referencesuseRandomFrameOrder
- order frames in encoded pixel data in random order rather than by source instance numberdoNotEncodeStackInformation
- do not include stack information in enhanced images even if used for frame order sorting- Returns:
- a file that is an enhanced multiframe image that was created
- Throws:
DicomException
- if an input file cannot be found for a frame, or it cannot be parsedIOException
- if an input file cannot be read
-
convertImages
public static File[] convertImages(Set<File> files, File outputFolder) throws DicomException, 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 are written in Explicit VR Little Endian Transfer Syntax.
- Parameters:
files
- a set of files (not folders) to convertoutputFolder
- a folder in which to store converted files (which must already exist)- Returns:
- the files created
- Throws:
DicomException
- if folder in which to store converted files does not existIOException
- if an input file cannot be read
-
convertImages
public static File[] convertImages(File[] files, File outputFolder) throws DicomException, 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 are written in Explicit VR Little Endian Transfer Syntax.
- Parameters:
files
- an array of files (not folders) to convertoutputFolder
- a folder in which to store converted files (which must already exist)- Returns:
- the files created
- Throws:
DicomException
- if folder in which to store converted files does not existIOException
- if an input file cannot be read
-
convertImages
public static File[] convertImages(String[] inputPaths, String outputPath) throws DicomException, 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 are written in Explicit VR Little Endian Transfer Syntax.
- Parameters:
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)- Returns:
- the files created
- Throws:
DicomException
- if folder in which to store converted files does not existIOException
- if an input file cannot be read
-
main
For testing, read all DICOM files and convert them to enhanced images when possible.
Files are written in Explicit VR Little Endian Transfer Syntax.
- Parameters:
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
-