本文整理汇总了Java中org.dcm4che2.data.DicomObject类的典型用法代码示例。如果您正苦于以下问题:Java DicomObject类的具体用法?Java DicomObject怎么用?Java DicomObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DicomObject类属于org.dcm4che2.data包,在下文中一共展示了DicomObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: query
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
public List<DicomObject> query() throws IOException, InterruptedException {
TransferCapability tc = assoc.getTransferCapabilityAsSCU(
UID.ModalityWorklistInformationModelFIND);
if (tc == null) {
throw new NoPresentationContextException(
"Modality Worklist not supported by "
+ remoteAE.getAETitle());
}
System.out.println("Send Query Request:");
System.out.println(keys.toString());
DimseRSP rsp = assoc.cfind(UID.ModalityWorklistInformationModelFIND,
priority, keys, tc.getTransferSyntax()[0], cancelAfter);
List<DicomObject> result = new ArrayList<DicomObject>();
while (rsp.next()) {
DicomObject cmd = rsp.getCommand();
if (CommandUtils.isPending(cmd)) {
DicomObject data = rsp.getDataset();
result.add(data);
System.out.println("\nReceived Query Response #"
+ result.size() + ":");
System.out.println(data.toString());
}
}
return result;
}
示例2: outValue
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
private void outValue(DicomInputStream in) throws IOException {
// System.out.println("outvalue");
int tag = in.tag();
VR vr = in.vr();
byte[] val = in.readBytes(in.valueLength());
DicomObject dcmobj = in.getDicomObject();
boolean bigEndian = in.getTransferSyntax().bigEndian();
line.append(" [xxx ");
vr.promptValue(val, bigEndian, dcmobj.getSpecificCharacterSet(),
cbuf, maxValLen, line);
line.append("xxx]");
if (tag == Tag.SpecificCharacterSet
|| tag == Tag.TransferSyntaxUID
|| TagUtils.isPrivateCreatorDataElement(tag)) {
dcmobj.putBytes(tag, vr, val, bigEndian);
}
if (tag == 0x00020000) {
in.setEndOfFileMetaInfoPosition(
in.getStreamPosition() + vr.toInt(val, bigEndian));
}
}
示例3: NetworkDicomImageListViewModelElement
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
/**
* Non-public c'tor that does the actual work. Exactly one of (url, file) must be != null.
*
* @param file
* @param url
* @param checkReadability
* @param dcmObjectCache passed to superclass (see there)
* @param imageFetchingJobsExecutor passed to superclass (see there)
*/
protected NetworkDicomImageListViewModelElement(File file, URL url, boolean checkReadability,
NumericPriorityMap<Object, DicomObject> dcmObjectCache, NumericPriorityThreadPoolExecutor imageFetchingJobsExecutor) {
super(dcmObjectCache, imageFetchingJobsExecutor);
try {
if (url != null) {
if (file != null) {
throw new IllegalArgumentException("exactly one of (url,file) must be != null");
}
urlAsFile = null;
setUrl(url, checkReadability);
} else {
//url == null
if (file == null) {
throw new IllegalArgumentException("exactly one of (url,file) must be != null");
}
urlAsFile = file.getAbsoluteFile();
setUrl(file.toURI().toURL(), checkReadability);
}
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
示例4: getBackendDicomObject
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
@Override
protected DicomObject getBackendDicomObject() {
checkInitialized();
try {
URLConnection connection = url.openConnection();
connection.setUseCaches(true);
connection.setDefaultUseCaches(true);
InputStream is = connection.getInputStream();
// mark/reset not supported for url so using FileCacheImageInputStream
DicomInputStream din = new DicomInputStream(new FileCacheImageInputStream(is, null));
try {
DicomObject dicomObject = din.readDicomObject();
return dicomObject;
} finally {
din.close();
}
} catch (IOException e) {
// TODO return error object instead?
throw new IllegalStateException("error reading DICOM object from " + url, e);
}
}
示例5: FileBasedDicomImageListViewModelElement
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
/**
* Non-public c'tor that does the actual work. Exactly one of (url, file) must be != null.
*
* @param file
* @param url
* @param checkReadability
* @param dcmObjectCache passed to superclass (see there)
* @param imageFetchingJobsExecutor passed to superclass (see there)
*/
protected FileBasedDicomImageListViewModelElement(File file, URL url, boolean checkReadability,
NumericPriorityMap<Object, DicomObject> dcmObjectCache, NumericPriorityThreadPoolExecutor imageFetchingJobsExecutor) {
super(dcmObjectCache, imageFetchingJobsExecutor);
try {
if (url != null) {
if (file != null) {
throw new IllegalArgumentException("exactly one of (url,file) must be != null");
}
urlAsFile = null;
setUrl(url, checkReadability);
} else {
//url == null
if (file == null) {
throw new IllegalArgumentException("exactly one of (url,file) must be != null");
}
urlAsFile = file.getAbsoluteFile();
setUrl(file.toURI().toURL(), checkReadability);
}
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
示例6: getBackendDicomObject
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
@Override
protected DicomObject getBackendDicomObject() {
// try {
// Thread.sleep(300);
// } catch (InterruptedException e1) {
// }
checkInitialized();
try {
DicomInputStream din = new DicomInputStream(url.openStream());
try {
return din.readDicomObject();
} finally {
din.close();
}
} catch (IOException e) {
// TODO return error object instead?
throw new IllegalStateException("error reading DICOM object from " + url, e);
}
}
示例7: getWindowing
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
public static ShortBuffer getWindowing(ArrayList<DicomObject> dicomList, ShortRange range) {
ShortBuffer windowing = ShortBuffer.allocate(dicomList.size() * 2);
for (DicomObject dicomObject : dicomList) {
short winCenter = (short) dicomObject.getFloat(Tag.WindowCenter);
short winWidth = (short) dicomObject.getFloat(Tag.WindowWidth);
if (winCenter == 0 && winWidth == 0) {
winWidth = (short) Math.min(range.getDelta(), Short.MAX_VALUE);
winCenter = (short) (range.getMin() + range.getDelta() / 2);
}
windowing.put(winCenter);
windowing.put(winWidth);
}
windowing.rewind();
return windowing;
}
示例8: getImageOrientationPatient
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
public static float[] getImageOrientationPatient(DicomObject o, int frame)
{
float[] iop;
if ((iop = o.getFloats(Tag.ImageOrientationPatient)) != null)
return iop;
// Check the shared first in the case of image orientation
int[] tagPath = {
Tag.SharedFunctionalGroupsSequence, 0,
Tag.PlaneOrientationSequence, 0,
Tag.ImageOrientationPatient };
if ((iop = o.getFloats(tagPath)) != null)
return iop;
tagPath[0] = Tag.PerFrameFunctionalGroupsSequence;
tagPath[1] = frame;
return o.getFloats(tagPath);
}
示例9: createLut
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
/**
* Return the complete lookup table to apply to the image data. This
* comprises the Modality LUT, VOI LUT and Presentation LUT. The Modality
* LUT can be represented as rescale slope/intercept, and the VOI LUT can be
* represented as window width/center/type. Presentation LUT will come from
* the specified values in the image read parameter, and is designed to turn
* p-values into DDLs (digital driving levels).
*
* @param param
* @param raster
* @return Complete lookup table to apply to the image.
*/
private LookupTable createLut(DicomImageReadParam param, int frame,
Raster raster, int outBits) {
short[] pval2gray = param.getPValue2Gray();
DicomObject pr = param.getPresentationState();
float c = param.getWindowCenter();
float w = param.getWindowWidth();
String vlutFct = param.getVoiLutFunction();
/* // windowing disabled for this reader
if (param.isAutoWindowing()) {
DicomObject voiObj = VOIUtils.selectVoiObject(ds, pr, frame);
if (voiObj == null) {
float[] cw = VOIUtils.getMinMaxWindowCenterWidth(ds, pr, frame,
raster);
c = cw[0];
w = cw[1];
vlutFct = LookupTable.LINEAR;
}
}
*/
return LookupTable.createLutForImageWithPR(ds, pr, frame, c, w,
vlutFct, outBits, pval2gray); // outBits is fixed to 8 in the original dcm4che source -- will this work?
}
示例10: maybeGetProxyRawImage
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
protected RawImageImpl maybeGetProxyRawImage() {
DicomObject imgMetadata = getDicomImageMetaData();
String transferSyntaxUID = imgMetadata.getString(Tag.TransferSyntaxUID);
//logger.debug(getImageKey());
//logger.debug("transferSyntaxUID : " + transferSyntaxUID);
//jpeg or rle compressed
if (transferSyntaxUID != null &&
(transferSyntaxUID.startsWith("1.2.840.10008.1.2.4") ||
transferSyntaxUID.startsWith("1.2.840.10008.1.2.5")))
return null;
int pixelType = getPixelType(imgMetadata);
if (pixelType == RawImage.PIXEL_TYPE_NOT_SUPPORTED)
return null;
int pixelFormat = getPixelFormat(imgMetadata);
if (pixelFormat == RawImage.PIXEL_FORMAT_NOT_SUPPORTED)
return null;
int width = imgMetadata.getInt(Tag.Columns);
int height = imgMetadata.getInt(Tag.Rows);
return new RawImageImpl(width, height, pixelFormat, pixelType, null);
}
示例11: setUsedPixelValuesRange
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
protected void setUsedPixelValuesRange() {
FloatRange range = super.getUsedPixelValuesRange();
//correct for RescaleSlope/-Intercept Tags
float min = range.getMin();
float max = range.getMax();
DicomObject metadata = getDicomImageMetaData();
if (metadata.contains(Tag.RescaleSlope) && metadata.contains(Tag.RescaleIntercept)) {
float rscSlope = metadata.getFloat(Tag.RescaleSlope);
float rscIntercept = metadata.getFloat(Tag.RescaleIntercept);
min = (int) (rscSlope * min + rscIntercept);
max = (int) (rscSlope * max + rscIntercept);
}
usedPixelValuesRange = new FloatRange(min, max);
}
示例12: main
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) throws Exception {
String fileName = args[0];
int scaleHeight = 30;
if (args.length >= 2) {
scaleHeight = Integer.parseInt(args[1]);
}
DicomInputStream din = new DicomInputStream(new File(fileName));
try {
DicomObject dobj = din.readDicomObject();
PaintGrayscaleIntoDcmImageApp app = new PaintGrayscaleIntoDcmImageApp();
app.paintGrayscaleInto(dobj, scaleHeight);
File outfile = new File(fileName + ".with-grayscale.dcm");
FileOutputStream fos = new FileOutputStream(outfile);
DicomOutputStream dos = new DicomOutputStream(fos);
try {
dos.writeDicomFile(dobj);
} finally {
dos.close();
}
} finally {
din.close();
}
}
示例13: readDicom
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
public static DicomObject readDicom(String filename) throws Exception
{
java.io.File file = new java.io.File(filename);
try
{
DicomObject obj = DicomUtil.readDicom(file);
// DicomPrinter printer=new DicomPrinter(obj,System.out);
// printer.printAll();
return obj;
}
catch (IOException e)
{
throw new Exception("IOException: couldn't read:" + filename + "\n" + e.getMessage(), e);
}
}
示例14: cmove
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
@Override
public void cmove(Association as, int pcid, DicomObject rq,
DicomObject data) throws DicomServiceException, IOException
{
log.info("just cmove");
log.info(CommandUtils.toString(rq, pcid, "1.2.2.2.2.2.2.0"));
DicomObject cmdrsp = CommandUtils.mkRSP(rq, CommandUtils.SUCCESS);
DimseRSP rsp = doCMove(as, pcid, rq, data, cmdrsp);
try {
rsp.next();
} catch (InterruptedException e) {
throw new DicomServiceException(rq, Status.ProcessingFailure);
}
cmdrsp = rsp.getCommand();
if (CommandUtils.isPending(cmdrsp))
{
as.registerCancelRQHandler(rq, rsp);
//executor.execute(new WriteMultiDimseRsp(as, pcid, rsp));
}
else
{
as.writeDimseRSP(pcid, cmdrsp, rsp.getDataset());
}
}
示例15: processFile
import org.dcm4che2.data.DicomObject; //导入依赖的package包/类
protected FSPath processFile(FSPath tmpDir, FSPath sourceFile, String destFilename) throws Exception
{
logger.debugPrintf("Processing dicom file:%s to:%s\n", sourceFile, destFilename);
DicomWrapper wrap = DicomWrapper.readFrom(sourceFile.getURI());
wrap.setIsModifyable(true);
wrap = dicomProcessor.process(wrap);
wrap.performChecks(true);
DicomObject dic = wrap.getDicomObject();
FSPath destFile = tmpDir.resolvePath(destFilename);
DicomUtil.writeDicom(dic, destFile.getPathname());
return destFile;
}