@Test public void testSelectVOIObjectShouldReturnImageIfOnlyWindowWidthAndCenter() { DicomObject obj = createWindowCenterObject(); assertSame(obj, VOIUtils.selectVoiObject(obj, null, 1)); }
public static DicomObject selectVoiObject(DicomObject img, DicomObject pr, int frame) { String iuid = img.getString(Tag.SOPInstanceUID); DicomObject voi = selectVoiItemFromPr(iuid, pr, frame); if (voi != null) { return voi; } if (pr != null) { return pr; } DicomElement framed = img.get(Tag.PerFrameFunctionalGroupsSequence); if (framed != null) { int size = framed.countItems(); if (frame >= 1 && frame <= size) { DicomObject frameObj = framed.getDicomObject(frame - 1); if (frameObj != null) { DicomObject voiObj = frameObj.getNestedDicomObject(Tag.FrameVOILUTSequence); if (voiObj != null && containsVOIAttributes(voiObj)) { return voiObj; } } } } DicomObject shared = img.getNestedDicomObject(Tag.SharedFunctionalGroupsSequence); if (shared != null) { DicomObject voiObj = shared.getNestedDicomObject(Tag.FrameVOILUTSequence); if (voiObj != null && containsVOIAttributes(voiObj)) { return voiObj; } } if (containsVOIAttributes(img)) return img; return null; }
VOIUtils { public static DicomObject selectVoiObject(DicomObject img, DicomObject pr, int frame) { String iuid = img.getString(Tag.SOPInstanceUID); DicomObject voi = selectVoiItemFromPr(iuid, pr, frame); if (voi != null) { return voi; } if (pr != null) { return pr; } DicomElement framed = img.get(Tag.PerFrameFunctionalGroupsSequence); if (framed != null) { int size = framed.countItems(); if (frame >= 1 && frame <= size) { DicomObject frameObj = framed.getDicomObject(frame - 1); if (frameObj != null) { DicomObject voiObj = frameObj.getNestedDicomObject(Tag.FrameVOILUTSequence); if (voiObj != null && containsVOIAttributes(voiObj)) { return voiObj; } } } } DicomObject shared = img.getNestedDicomObject(Tag.SharedFunctionalGroupsSequence); if (shared != null) { DicomObject voiObj = shared.getNestedDicomObject(Tag.FrameVOILUTSequence); if (voiObj != null && containsVOIAttributes(voiObj)) { return voiObj; } } if (containsVOIAttributes(img)) return img; return null; } }
VOIUtils { public static DicomObject selectVoiObject(DicomObject img, DicomObject pr, int frame) { String iuid = img.getString(Tag.SOPInstanceUID); DicomObject voi = selectVoiItemFromPr(iuid, pr, frame); if (voi != null) { return voi; } if (pr != null) { return pr; } DicomElement framed = img.get(Tag.PerFrameFunctionalGroupsSequence); if (framed != null) { int size = framed.countItems(); if (frame >= 1 && frame <= size) { DicomObject frameObj = framed.getDicomObject(frame - 1); if (frameObj != null) { DicomObject voiObj = frameObj.getNestedDicomObject(Tag.FrameVOILUTSequence); if (voiObj != null && containsVOIAttributes(voiObj)) { return voiObj; } } } } DicomObject shared = img.getNestedDicomObject(Tag.SharedFunctionalGroupsSequence); if (shared != null) { DicomObject voiObj = shared.getNestedDicomObject(Tag.FrameVOILUTSequence); if (voiObj != null && containsVOIAttributes(voiObj)) { return voiObj; } } if (containsVOIAttributes(img)) return img; return null; }  }
VOIUtils { public static DicomObject selectVoiObject(DicomObject img, DicomObject pr, int frame) { String iuid = img.getString(Tag.SOPInstanceUID); DicomObject voi = selectVoiItemFromPr(iuid, pr, frame); if (voi != null) { return voi; } if (pr != null) { return pr; } DicomElement framed = img.get(Tag.PerFrameFunctionalGroupsSequence); if (framed != null) { int size = framed.countItems(); if (frame >= 1 && frame <= size) { DicomObject frameObj = framed.getDicomObject(frame - 1); if (frameObj != null) { DicomObject voiObj = frameObj.getNestedDicomObject(Tag.FrameVOILUTSequence); if (voiObj != null && containsVOIAttributes(voiObj)) { return voiObj; } } } } DicomObject shared = img.getNestedDicomObject(Tag.SharedFunctionalGroupsSequence); if (shared != null) { DicomObject voiObj = shared.getNestedDicomObject(Tag.FrameVOILUTSequence); if (voiObj != null && containsVOIAttributes(voiObj)) { return voiObj; } } if (containsVOIAttributes(img)) return img; return null; }  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); }
VOIUtils { public static DicomObject selectVoiObject(DicomObject img, DicomObject pr, int frame) { String iuid = img.getString(Tag.SOPInstanceUID); DicomObject voi = selectVoiItemFromPr(iuid, pr, frame); if (voi != null) { return voi; } if (pr != null) { return pr; } DicomElement framed = img.get(Tag.PerFrameFunctionalGroupsSequence); if (framed != null) { int size = framed.countItems(); if (frame >= 1 && frame <= size) { DicomObject frameObj = framed.getDicomObject(frame - 1); if (frameObj != null) { DicomObject voiObj = frameObj.getNestedDicomObject(Tag.FrameVOILUTSequence); if (voiObj != null && containsVOIAttributes(voiObj)) { return voiObj; } } } } DicomObject shared = img.getNestedDicomObject(Tag.SharedFunctionalGroupsSequence); if (shared != null) { DicomObject voiObj = shared.getNestedDicomObject(Tag.FrameVOILUTSequence); if (voiObj != null && containsVOIAttributes(voiObj)) { return voiObj; } } if (containsVOIAttributes(img)) return img; return null; }  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);  }