Package com.pixelmed.convert

## Class ConvertAmicasJPEG2000FilesetToDicom

- java.lang.Object
- - com.pixelmed.convert.ConvertAmicasJPEG2000FilesetToDicom

-     public class ConvertAmicasJPEG2000FilesetToDicom
      extends java.lang.Object

  This class provides conversion of a set of Amicas JPEG 2000 files to DICOM.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `class` | `ConvertAmicasJPEG2000FilesetToDicom.OnlyDirectoriesFileFilter` | Instances of this class select only Files that are directories.
    `class` | `ConvertAmicasJPEG2000FilesetToDicom.OnlySuffixFilenameFilter` | Instances of this class select only File names that end with the specified suffix.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected java.lang.String` | `mediaDirectoryPath` |
    `protected ConvertAmicasJPEG2000FilesetToDicom.OnlyDirectoriesFileFilter` | `onlyDirectoriesFileFilter` |
    `protected ConvertAmicasJPEG2000FilesetToDicom.OnlySuffixFilenameFilter` | `onlyXMLFilenameFilter` |
    `protected java.io.PrintWriter` | `pwlogger` |
    `protected SpecificCharacterSet` | `specificCharacterSet` |
    `protected static UIDGenerator` | `uidGenerator` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ConvertAmicasJPEG2000FilesetToDicom()` | Construct an converter that will looked for files in the system default path.
    `ConvertAmicasJPEG2000FilesetToDicom​(java.lang.String mediaDirectoryPath)` | Construct an converter that will looked for files in the specified path.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `addDicomAttributeFromXmlAttribute​(AttributeList list, AttributeTag tag, java.lang.String xmlAttributeName, org.w3c.dom.NamedNodeMap xmlAttributes, int type, java.lang.String defaultValueForType1)` |
    `void` | `choosePathsAndConvertAmicasFiles()` | Pop up folder chooser dialogs that allow the user to specify the location of the amicas-patients folder, or the parent folder (for example, the drive or volume) in which the amicas-patients folder is located, and the output folder to store the converted DICOM files, and then perform the conversion.
    `void` | `convertAmicasFiles​(java.lang.String pathName, java.lang.String dicomOutputFolder)` | Read an amicas-patients folder, and then convert any image files within.
    `protected void` | `createDicomImageFileFromAmicasImageFile​(java.io.File amicasFolder, java.lang.String amicasFileName, java.lang.String dicomOutputFolder, java.lang.String storingAETitle, AttributeList patientList, AttributeList studyList, AttributeList seriesList, AttributeList imageList)` |
    `protected java.lang.String` | `getNamedAttributeValue​(org.w3c.dom.NamedNodeMap xmlAttributes, java.lang.String xmlAttributeName)` |
    `static void` | `main​(java.lang.String[] arg)` | Convert a set of Amicas JPEG 2000 files to DICOM.
    `protected AttributeList` | `makeAttributeListForImage​(org.w3c.dom.NamedNodeMap xmlAttributes)` |
    `protected AttributeList` | `makeAttributeListForPatient​(org.w3c.dom.NamedNodeMap xmlAttributes)` |
    `protected AttributeList` | `makeAttributeListForSeries​(org.w3c.dom.NamedNodeMap xmlAttributes)` |
    `protected AttributeList` | `makeAttributeListForStudy​(org.w3c.dom.NamedNodeMap xmlAttributes)` |
    `protected Attribute` | `makeDicomAttributeFromXmlAttribute​(AttributeTag tag, java.lang.String xmlAttributeName, org.w3c.dom.NamedNodeMap xmlAttributes, int type, java.lang.String defaultValue)` |
    `protected Attribute` | `newAttribute​(AttributeTag tag)` |
    `void` | `setLogger​(java.io.OutputStream stream)` |
    `void` | `setLogger​(java.io.PrintWriter pwlogger)` |
    `void` | `setLogger​(javax.swing.JFrame content, int width, int height)` |
    `protected static SpecificCharacterSet` | `setSpecificCharacterSetFromDocumentEncoding​(org.w3c.dom.Document document)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### mediaDirectoryPath

          protected java.lang.String mediaDirectoryPath

    - #### pwlogger

          protected java.io.PrintWriter pwlogger

    - #### onlyDirectoriesFileFilter

          protected ConvertAmicasJPEG2000FilesetToDicom.OnlyDirectoriesFileFilter onlyDirectoriesFileFilter

    - #### onlyXMLFilenameFilter

          protected ConvertAmicasJPEG2000FilesetToDicom.OnlySuffixFilenameFilter onlyXMLFilenameFilter

    - #### specificCharacterSet

          protected SpecificCharacterSet specificCharacterSet

    - #### uidGenerator

          protected static UIDGenerator uidGenerator

  - ### Constructor Detail

    - #### ConvertAmicasJPEG2000FilesetToDicom

          public ConvertAmicasJPEG2000FilesetToDicom()

      Construct an converter that will looked for files in the system default path.

    - #### ConvertAmicasJPEG2000FilesetToDicom

          public ConvertAmicasJPEG2000FilesetToDicom​(java.lang.String mediaDirectoryPath)

      Construct an converter that will looked for files in the specified path.

      Parameters:
        `mediaDirectoryPath` - where to begin looking for the amicas-patients folder

  - ### Method Detail

    - #### setLogger

          public void setLogger​(java.io.PrintWriter pwlogger)

    - #### setLogger

          public void setLogger​(java.io.OutputStream stream)

    - #### setLogger

          public void setLogger​(javax.swing.JFrame content,
                                int width,
                                int height)

    - #### choosePathsAndConvertAmicasFiles

          public void choosePathsAndConvertAmicasFiles()
                                                throws java.io.IOException,
                                                       DicomException,
                                                       javax.xml.parsers.ParserConfigurationException,
                                                       org.xml.sax.SAXException

      Pop up folder chooser dialogs that allow the user to specify the location of the amicas-patients folder, or the parent folder (for example, the drive or volume) in which the amicas-patients folder is located, and the output folder to store the converted DICOM files, and then perform the conversion.

      Throws:
        `java.io.IOException`
        `DicomException`
        `javax.xml.parsers.ParserConfigurationException`
        `org.xml.sax.SAXException`

    - #### newAttribute

          protected Attribute newAttribute​(AttributeTag tag)
                                    throws DicomException

      Throws:
        `DicomException`

    - #### getNamedAttributeValue

          protected java.lang.String getNamedAttributeValue​(org.w3c.dom.NamedNodeMap xmlAttributes,
                                                            java.lang.String xmlAttributeName)

    - #### makeDicomAttributeFromXmlAttribute

          protected Attribute makeDicomAttributeFromXmlAttribute​(AttributeTag tag,
                                                                 java.lang.String xmlAttributeName,
                                                                 org.w3c.dom.NamedNodeMap xmlAttributes,
                                                                 int type,
                                                                 java.lang.String defaultValue)
                                                          throws DicomException

      Throws:
        `DicomException`

    - #### addDicomAttributeFromXmlAttribute

          protected void addDicomAttributeFromXmlAttribute​(AttributeList list,
                                                           AttributeTag tag,
                                                           java.lang.String xmlAttributeName,
                                                           org.w3c.dom.NamedNodeMap xmlAttributes,
                                                           int type,
                                                           java.lang.String defaultValueForType1)
                                                    throws DicomException

      Throws:
        `DicomException`

    - #### makeAttributeListForPatient

          protected AttributeList makeAttributeListForPatient​(org.w3c.dom.NamedNodeMap xmlAttributes)
                                                       throws DicomException

      Throws:
        `DicomException`

    - #### makeAttributeListForStudy

          protected AttributeList makeAttributeListForStudy​(org.w3c.dom.NamedNodeMap xmlAttributes)
                                                     throws DicomException

      Throws:
        `DicomException`

    - #### makeAttributeListForSeries

          protected AttributeList makeAttributeListForSeries​(org.w3c.dom.NamedNodeMap xmlAttributes)
                                                      throws DicomException

      Throws:
        `DicomException`

    - #### makeAttributeListForImage

          protected AttributeList makeAttributeListForImage​(org.w3c.dom.NamedNodeMap xmlAttributes)
                                                     throws DicomException

      Throws:
        `DicomException`

    - #### setSpecificCharacterSetFromDocumentEncoding

          protected static SpecificCharacterSet setSpecificCharacterSetFromDocumentEncoding​(org.w3c.dom.Document document)

    - #### createDicomImageFileFromAmicasImageFile

          protected void createDicomImageFileFromAmicasImageFile​(java.io.File amicasFolder,
                                                                 java.lang.String amicasFileName,
                                                                 java.lang.String dicomOutputFolder,
                                                                 java.lang.String storingAETitle,
                                                                 AttributeList patientList,
                                                                 AttributeList studyList,
                                                                 AttributeList seriesList,
                                                                 AttributeList imageList)
                                                          throws java.io.IOException,
                                                                 DicomException

      Throws:
        `java.io.IOException`
        `DicomException`

    - #### convertAmicasFiles

          public void convertAmicasFiles​(java.lang.String pathName,
                                         java.lang.String dicomOutputFolder)
                                  throws java.io.IOException,
                                         DicomException,
                                         javax.xml.parsers.ParserConfigurationException,
                                         org.xml.sax.SAXException

      Read an amicas-patients folder, and then convert any image files within.

      Parameters:
        `pathName` - the path name to an amicas-patients folder or folder containing an amicas-patients folder
        `dicomOutputFolder` - the path name to where to write the DICOM files
      Throws:
        `java.io.IOException`
        `DicomException`
        `javax.xml.parsers.ParserConfigurationException`
        `org.xml.sax.SAXException`

    - #### main

          public static void main​(java.lang.String[] arg)

      Convert a set of Amicas JPEG 2000 files to DICOM.

      Parameters:
        `arg` - array of two strings - the path to the media or folder containing the files to convert, and the path to the folder to stored the converted images, or else will pop up file chooser dialogs to select these and create a frame to show the progress.