From: <way...@us...> - 2007-09-28 13:31:54
|
Revision: 5202 http://dcm4che.svn.sourceforge.net/dcm4che/?rev=5202&view=rev Author: wayfarer3130 Date: 2007-09-28 06:31:51 -0700 (Fri, 28 Sep 2007) Log Message: ----------- JIRA DCM-96 Added spatial transformation and displayed area access to the GSPS data. Modified Paths: -------------- dcm4che2/trunk/dcm4che-image/.classpath dcm4che2/trunk/dcm4che-iod/src/main/java/org/dcm4che2/iod/module/pr/DisplayedAreaModule.java dcm4che2/trunk/dcm4che-iod/src/main/java/org/dcm4che2/iod/module/pr/SpatialTransformationModule.java Modified: dcm4che2/trunk/dcm4che-image/.classpath =================================================================== --- dcm4che2/trunk/dcm4che-image/.classpath 2007-09-28 11:08:31 UTC (rev 5201) +++ dcm4che2/trunk/dcm4che-image/.classpath 2007-09-28 13:31:51 UTC (rev 5202) @@ -1,7 +1,8 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src/main/java"/> - <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="output" path="target/classes"/> -</classpath> +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src/main/java"/> + <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry combineaccessrules="false" kind="src" path="/dcm4che-core"/> + <classpathentry kind="output" path="target/classes"/> +</classpath> Modified: dcm4che2/trunk/dcm4che-iod/src/main/java/org/dcm4che2/iod/module/pr/DisplayedAreaModule.java =================================================================== --- dcm4che2/trunk/dcm4che-iod/src/main/java/org/dcm4che2/iod/module/pr/DisplayedAreaModule.java 2007-09-28 11:08:31 UTC (rev 5201) +++ dcm4che2/trunk/dcm4che-iod/src/main/java/org/dcm4che2/iod/module/pr/DisplayedAreaModule.java 2007-09-28 13:31:51 UTC (rev 5202) @@ -38,8 +38,12 @@ package org.dcm4che2.iod.module.pr; +import org.dcm4che2.data.DicomElement; import org.dcm4che2.data.DicomObject; +import org.dcm4che2.data.Tag; +import org.dcm4che2.data.VR; import org.dcm4che2.iod.module.Module; +import org.dcm4che2.iod.module.macro.ImageSOPInstanceReference; /** * C.10.4 IOD for Displayed Area information. @@ -54,5 +58,68 @@ super(dcmobj); } + public static DisplayedAreaModule[] toDisplayedAreaModules(DicomObject dcmobj) { + DicomElement sq = dcmobj.get(Tag.DisplayedAreaSelectionSequence); + if (sq == null || !sq.hasItems()) { + return null; + } + DisplayedAreaModule[] a = new DisplayedAreaModule[sq.countItems()]; + for (int i = 0; i < a.length; i++) { + a[i] = new DisplayedAreaModule(sq.getDicomObject(i)); + } + return a; + } + /** Gets the image sop instance references, null if none (means to apply everywhere). */ + public ImageSOPInstanceReference[] getImageSOPInstanceReferences() { + return ImageSOPInstanceReference.toImageSOPInstanceReferences(dcmobj.get(Tag.ReferencedImageSequence)); + } + + public int[] getDisplayedAreaTopLeftHandCorner() { + return dcmobj.getInts(Tag.DisplayedAreaTopLeftHandCorner); + } + + public void setDisplayedAreaTopLeftHandCorner(int[] tlhc) { + dcmobj.putInts(Tag.DisplayedAreaTopLeftHandCorner, VR.IS, tlhc); + } + + public int[] getDisplayedAreaBottomRightHandCorner() { + return dcmobj.getInts(Tag.DisplayedAreaBottomRightHandCorner); + } + + public void setDisplayedAreaBottomrRightHandCorner(int[] brhc) { + dcmobj.putInts(Tag.DisplayedAreaBottomRightHandCorner, VR.IS, brhc); + } + + public String getPresentationSizeMode() { + return dcmobj.getString(Tag.PresentationSizeMode); + } + + public void setPresentationSizeMode(String mode) { + dcmobj.putString(Tag.PresentationSizeMode, VR.CS, mode); + } + + public float[] getPresentationPixelSpacing() { + return dcmobj.getFloats(Tag.PresentationPixelSpacing); + } + + public void setPresentationPixelSpacing(float[] spacing) { + dcmobj.putFloats(Tag.PresentationPixelSpacing, VR.DS, spacing); + } + + public int[] getPresentationPixelAspectRatio() { + return dcmobj.getInts(Tag.PresentationPixelAspectRatio); + } + + public void setPresentationPixelAspectRatio(int[] aspect) { + dcmobj.putInts(Tag.PresentationPixelSpacing, VR.IS, aspect); + } + + public float getPresentationPixelMagnificationRatio() { + return dcmobj.getFloat(Tag.PresentationPixelMagnificationRatio); + } + + public void setPresentationPixelMagnificationRatio(float magnify) { + dcmobj.putFloat(Tag.PresentationPixelMagnificationRatio, VR.DS, magnify); + } } Modified: dcm4che2/trunk/dcm4che-iod/src/main/java/org/dcm4che2/iod/module/pr/SpatialTransformationModule.java =================================================================== --- dcm4che2/trunk/dcm4che-iod/src/main/java/org/dcm4che2/iod/module/pr/SpatialTransformationModule.java 2007-09-28 11:08:31 UTC (rev 5201) +++ dcm4che2/trunk/dcm4che-iod/src/main/java/org/dcm4che2/iod/module/pr/SpatialTransformationModule.java 2007-09-28 13:31:51 UTC (rev 5202) @@ -38,6 +38,8 @@ package org.dcm4che2.iod.module.pr; import org.dcm4che2.data.DicomObject; +import org.dcm4che2.data.Tag; +import org.dcm4che2.data.VR; import org.dcm4che2.iod.module.Module; /** @@ -54,4 +56,20 @@ } + /** This gets the regular rotation of the object */ + public int getRotation() { + return dcmobj.getInt(Tag.ImageRotation); + } + + public void setRotation(int rotation) { + dcmobj.putInt(Tag.ImageRotation, VR.IS, rotation); + } + + public boolean isHorizontalFlip() { + return "Y".equalsIgnoreCase(dcmobj.getString(Tag.ImageHorizontalFlip)); + } + + public void setHorizontalFlip(boolean flip) { + dcmobj.putString(Tag.ImageHorizontalFlip, VR.CS, (flip ? "Y" : "N")); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |