VOIUtils { public static DicomObject getLUT(DicomObject dobj, int sqTag) { DicomObject lut = dobj.getNestedDicomObject(sqTag); if (lut != null) { if (!lut.containsValue(Tag.LUTData)) { log.info("Ignore " + TagUtils.toString(sqTag) + " with missing LUT Data (0028,3006)"); return null; } if (!lut.containsValue(Tag.LUTDescriptor)) { log.info("Ignore " + TagUtils.toString(sqTag) + " with missing LUT Descriptor (0028,3002)"); return null; } } return lut; }  static boolean containsVOIAttributes(DicomObject dobj); static DicomObject getLUT(DicomObject dobj, int sqTag); static boolean isModalityLUTcontainsPixelIntensityRelationshipLUT(
            DicomObject img); static boolean isModalityLUTcontainsPixelIntensityRelationshipLUT(
            String uid); static DicomObject selectModalityLUTObject(DicomObject img,
            DicomObject pr, int frame); static DicomObject selectVoiObject(DicomObject img, DicomObject pr, int frame); static DicomObject selectVoiItemFromPr(String iuid, DicomObject pr,
            int frame); static float[] getMinMaxWindowCenterWidth(DicomObject img,
            DicomObject pr, int frame, Raster raster); static int[] calcMinMax(DicomObject img, Raster raster);  }
@Test public void testGetLUTShouldReturnNullIfLutDescriptorIsMissing() { DicomObject mlut = new BasicDicomObject(); mlut.putInts(Tag.LUTData, VR.US, new int[] { 255 }); mlut.putString(Tag.ModalityLUTSequence, VR.LO, "HU"); DicomObject obj = new BasicDicomObject(); obj.putNestedDicomObject(Tag.ModalityLUTSequence, mlut); assertNull(VOIUtils.getLUT(obj, Tag.ModalityLUTSequence)); }
@Test public void testGetLUTShouldReturnTheSpecifiedLutSequence() { DicomObject mlut = new BasicDicomObject(); mlut.putInts(Tag.LUTDescriptor, VR.US, new int[] { 1, 0, 8 }); mlut.putInts(Tag.LUTData, VR.US, new int[] { 255 }); mlut.putString(Tag.ModalityLUTSequence, VR.LO, "HU"); DicomObject obj = new BasicDicomObject(); obj.putNestedDicomObject(Tag.ModalityLUTSequence, mlut); assertSame(mlut, VOIUtils.getLUT(obj, Tag.ModalityLUTSequence)); }
@Test public void testGetLUTShouldReturnNullIfLutDataIsMissing() { DicomObject mlut = new BasicDicomObject(); mlut.putInts(Tag.LUTDescriptor, VR.US, new int[] { 1, 0, 8 }); mlut.putString(Tag.ModalityLUTSequence, VR.LO, "HU"); DicomObject obj = new BasicDicomObject(); obj.putNestedDicomObject(Tag.ModalityLUTSequence, mlut); assertNull(VOIUtils.getLUT(obj, Tag.ModalityLUTSequence)); }