com.pixelmed.convert

## Class IndexedLabelMapToSegmentation

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

    public class IndexedLabelMapToSegmentation
    extends java.lang.Object

### Nested Class Summary

Nested Classes
`protected class` `IndexedLabelMapToSegmentation.LabelInformation`

### Field Summary

Fields
`protected java.lang.Integer` `backgroundIndex`
`protected IndexedLabelMapToSegmentation.LabelInformation` `backgroundLabel`
`protected static java.util.Set<java.lang.String>` `spatialAndRelationalConcepts`
`protected static java.util.Set<java.lang.String>` `tissueConcepts`

### Constructor Summary

Constructors
Constructor and Description
`IndexedLabelMapToSegmentation(java.lang.String inputFilename, java.lang.String labelFilename, java.lang.String outputFilename, java.lang.String referenceImageFilename, java.lang.String seriesNumber, java.lang.String seriesDescription, java.lang.String contentLabel, java.lang.String contentDescription, java.lang.String contentCreatorName)`

### Method Summary

Methods
`protected void` `addAppropriateSegmentedPropertyCategoryCodeSequence(AttributeList list, IndexedLabelMapToSegmentation.LabelInformation labelinfo)`
`protected static SequenceAttribute` `addCodedSequenceAttribute(AttributeList list, AttributeTag tag, CodedSequenceItem csi)`
`protected java.util.Map<java.lang.Integer,java.lang.Integer>` `addSegmentSequence(AttributeList list, java.util.Set<java.lang.Integer> usedLabels, java.util.Map<java.lang.Integer,IndexedLabelMapToSegmentation.LabelInformation> labelMap, java.util.Set<java.lang.Integer> unrecognizedLabels)`
`protected void` `addSegmentSequenceItem(SequenceAttribute saSegmentSequence, IndexedLabelMapToSegmentation.LabelInformation labelinfo)`
`protected void` `addSegmentSequenceItem(SequenceAttribute saSegmentSequence, int index, IndexedLabelMapToSegmentation.LabelInformation labelinfo)`
`protected java.lang.String` `getStringNoLongerThan64TruncatedIfNecessary(java.lang.String s)`
`static void` `main(java.lang.String[] arg)` Read a DICOM image containing pixel values that are indices into a label map and the corresponding map and convert to a DICOM Segmentation object.
`protected static SequenceAttribute` `newCodedSequenceAttribute(AttributeTag tag, CodedSequenceItem csi)`
`protected java.util.Map<java.lang.Integer,IndexedLabelMapToSegmentation.LabelInformation>` `readLabelMapFile(java.lang.String filename)`
`protected void` `setBit(byte[] pixelData, int f, int r, int c, int rows, int columns)`

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

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

### Field Detail

#### spatialAndRelationalConcepts

    protected static final java.util.Set<java.lang.String> spatialAndRelationalConcepts

#### tissueConcepts

    protected static final java.util.Set<java.lang.String> tissueConcepts

#### backgroundLabel

    protected IndexedLabelMapToSegmentation.LabelInformation backgroundLabel

#### backgroundIndex

    protected java.lang.Integer backgroundIndex

### Constructor Detail

#### IndexedLabelMapToSegmentation

    public IndexedLabelMapToSegmentation(java.lang.String inputFilename,
                                 java.lang.String labelFilename,
                                 java.lang.String outputFilename,
                                 java.lang.String referenceImageFilename,
                                 java.lang.String seriesNumber,
                                 java.lang.String seriesDescription,
                                 java.lang.String contentLabel,
                                 java.lang.String contentDescription,
                                 java.lang.String contentCreatorName)
                                  throws java.io.IOException,
                                         java.lang.NumberFormatException,
                                         DicomException

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

### Method Detail

#### getStringNoLongerThan64TruncatedIfNecessary

    protected java.lang.String getStringNoLongerThan64TruncatedIfNecessary(java.lang.String s)

#### readLabelMapFile

    protected java.util.Map<java.lang.Integer,IndexedLabelMapToSegmentation.LabelInformation> readLabelMapFile(java.lang.String filename)
                                                                                                        throws java.io.IOException,
                                                                                                               java.lang.NumberFormatException

Throws:
  `java.io.IOException`
  `java.lang.NumberFormatException`

#### addAppropriateSegmentedPropertyCategoryCodeSequence

    protected void addAppropriateSegmentedPropertyCategoryCodeSequence(AttributeList list,
                                                           IndexedLabelMapToSegmentation.LabelInformation labelinfo)
                                                                throws DicomException

Throws:
  `DicomException`

#### newCodedSequenceAttribute

    protected static SequenceAttribute newCodedSequenceAttribute(AttributeTag tag,
                                              CodedSequenceItem csi)

#### addCodedSequenceAttribute

    protected static SequenceAttribute addCodedSequenceAttribute(AttributeList list,
                                              AttributeTag tag,
                                              CodedSequenceItem csi)

#### addSegmentSequenceItem

    protected void addSegmentSequenceItem(SequenceAttribute saSegmentSequence,
                              int index,
                              IndexedLabelMapToSegmentation.LabelInformation labelinfo)
                                   throws DicomException

Throws:
  `DicomException`

#### addSegmentSequenceItem

    protected void addSegmentSequenceItem(SequenceAttribute saSegmentSequence,
                              IndexedLabelMapToSegmentation.LabelInformation labelinfo)
                                   throws DicomException

Throws:
  `DicomException`

#### addSegmentSequence

    protected java.util.Map<java.lang.Integer,java.lang.Integer> addSegmentSequence(AttributeList list,
                                                                        java.util.Set<java.lang.Integer> usedLabels,
                                                                        java.util.Map<java.lang.Integer,IndexedLabelMapToSegmentation.LabelInformation> labelMap,
                                                                        java.util.Set<java.lang.Integer> unrecognizedLabels)
                                                                             throws DicomException

Throws:
  `DicomException`

#### setBit

    protected void setBit(byte[] pixelData,
              int f,
              int r,
              int c,
              int rows,
              int columns)

#### main

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

Read a DICOM image containing pixel values that are indices into a label map and the corresponding map and convert to a DICOM Segmentation object.

Parameters:
  `arg` - three or more parameters, the inputFile, the CSV file containing a list of labels and their coded values, the outputFile, the reference image file, and optionally, the series number, series description, content label, content description and content creator