本文整理汇总了Java中org.dcm4che3.data.Attributes类的典型用法代码示例。如果您正苦于以下问题:Java Attributes类的具体用法?Java Attributes怎么用?Java Attributes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Attributes类属于org.dcm4che3.data包,在下文中一共展示了Attributes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDimseRSP
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
@Override
public void onDimseRSP(Association as, Attributes cmd, Attributes data)
{
super.onDimseRSP(as, cmd, data);
status = cmd.getInt(Tag.Status, -1);
if (Status.isPending(status)) {
completed = cmd.getInt(Tag.NumberOfCompletedSuboperations, -1);
remaining = cmd.getInt(Tag.NumberOfRemainingSuboperations, -1);
warning = cmd.getInt(Tag.NumberOfWarningSuboperations, -1);
failed = cmd.getInt(Tag.NumberOfFailedSuboperations, -1);
}
else {
completed = cmd.getInt(Tag.NumberOfCompletedSuboperations, -1);
remaining = 0;
warning = cmd.getInt(Tag.NumberOfWarningSuboperations, -1);
failed = cmd.getInt(Tag.NumberOfFailedSuboperations, -1);
error = cmd.getString(Tag.ErrorComment, "");
}
}
示例2: onDimseRQ
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
@Override
public void onDimseRQ(Association as,
PresentationContext pc,
Dimse dimse,
Attributes cmd,
Attributes data) throws IOException
{
super.onDimseRQ(as, pc, dimse, cmd, data);
Socket s = as.getSocket();
logger.info("Handled C-ECHO request from: {}@{}:{}",
as.getCallingAET(),
s.getInetAddress().getHostAddress(),
s.getPort());
}
示例3: onDimseRSP
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
@Override
public void onDimseRSP(Association as, Attributes cmd,
Attributes data)
{
super.onDimseRSP(as, cmd, data);
if (index++ >= offset) {
if (limit == 0 || results.size() < limit) {
results.add(data);
}
else {
// TODO: Add support for issuing a cancel
logger.debug("Ignoring: {}", data);
}
}
}
示例4: main
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
public static void main(String argv[])
{
AttributeId id = new AttributeId("OtherPatientIDsSequence.IssuerOfPatientIDQualifiersSequence.UniversalEntityID");
Attributes test = new Attributes();
id.setValue(test, "1234");
id = new AttributeId("OtherPatientIDsSequence.IssuerOfPatientIDQualifiersSequence.IdentifierTypeCode");
id.setValue(test, "5678");
id = new AttributeId("OtherPatientIDsSequence.IssuerOfPatientIDQualifiersSequence.AssigningFacilitySequence.UniversalEntityID");
id.setValue(test, "abcd");
id = new AttributeId("OtherPatientIDsSequence.IssuerOfPatientIDQualifiersSequence.AssigningFacilitySequence.LocalNamespaceEntityID");
id.ensureExists(test);
System.out.println(test);
}
示例5: send
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
@Override
protected void send(Path path) throws Exception
{
Part part = new Part(APPLICATION_DICOM);
out.addPart(part);
if (acceptableTransferSyntaxes.contains("*")) {
// Client accepts any transfer syntax so just send the file
FileUtils.copyFile(path.toFile(), out);
}
else {
String tx = DicomUtil.getTransferSyntax(path);
if (acceptableTransferSyntaxes.contains(tx)) {
// Client accepts the transfer syntax of the file, so just send it
FileUtils.copyFile(path.toFile(), out);
}
else {
// Client does not accept the transfer syntax of the file, so we transcode it to LEE
try (Transcoder transcoder = new Transcoder(path.toFile())) {
transcoder.setDestinationTransferSyntax(ExplicitVRLittleEndian);
transcoder.setIncludeFileMetaInformation(true);
transcoder.setCloseInputStream(true);
transcoder.setCloseOutputStream(false);
transcoder.setIncludeBulkData(DicomInputStream.IncludeBulkData.YES);
transcoder.transcode((Transcoder t, Attributes dataset) -> out);
}
}
}
}
示例6: fillStudy
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
private void fillStudy(DicomParam[] keysStudies) {
try {
DicomState state =
CFind.process(advancedParams, callingNode, calledNode, 0, QueryRetrieveLevel.STUDY, keysStudies);
LOGGER.debug("C-FIND at study level {}", state.getMessage());
List<Attributes> studies = state.getDicomRSP();
if (studies != null) {
for (Attributes studyDataSet : studies) {
fillSeries(studyDataSet);
}
}
} catch (Exception e) {
LOGGER.error("DICOM query Error of {}", getArchiveConfigName(), e);
}
}
示例7: fillSeries
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
private void fillSeries(Attributes studyDataSet) {
String studyInstanceUID = studyDataSet.getString(Tag.StudyInstanceUID);
if (StringUtil.hasText(studyInstanceUID)) {
DicomParam[] keysSeries = {
// Matching Keys
new DicomParam(Tag.StudyInstanceUID, studyInstanceUID),
// Return Keys
CFind.SeriesInstanceUID, CFind.Modality, CFind.SeriesNumber, CFind.SeriesDescription };
DicomState state =
CFind.process(advancedParams, callingNode, calledNode, 0, QueryRetrieveLevel.SERIES, keysSeries);
LOGGER.debug("C-FIND with StudyInstanceUID {}", state.getMessage());
List<Attributes> series = state.getDicomRSP();
if (series != null && !series.isEmpty()) {
// Get patient from each study in case IssuerOfPatientID is different
Patient patient = getPatient(studyDataSet);
Study study = getStudy(patient, studyDataSet);
for (Attributes seriesDataset : series) {
fillInstance(seriesDataset, study);
}
}
}
}
示例8: getPatient
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
private Patient getPatient(Attributes patientDataset) {
if (patientDataset == null) {
throw new IllegalArgumentException("patientDataset cannot be null");
}
fillPatientAttributes(patientDataset);
String id = patientDataset.getString(Tag.PatientID, "Unknown");
String ispid = patientDataset.getString(Tag.IssuerOfPatientID);
Patient p = getPatient(id, ispid);
if (p == null) {
p = new Patient(id, ispid);
p.setPatientName(patientDataset.getString(Tag.PatientName));
// Only set birth date, birth time is often not consistent (00:00)
p.setPatientBirthDate(patientDataset.getString(Tag.PatientBirthDate));
p.setPatientSex(patientDataset.getString(Tag.PatientSex));
addPatient(p);
}
return p;
}
示例9: getStudy
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
private static Study getStudy(Patient patient, final Attributes studyDataset) {
if (studyDataset == null) {
throw new IllegalArgumentException("studyDataset cannot be null");
}
String uid = studyDataset.getString(Tag.StudyInstanceUID);
Study s = patient.getStudy(uid);
if (s == null) {
s = new Study(uid);
s.setStudyDescription(studyDataset.getString(Tag.StudyDescription));
s.setStudyDate(studyDataset.getString(Tag.StudyDate));
s.setStudyTime(studyDataset.getString(Tag.StudyTime));
s.setAccessionNumber(studyDataset.getString(Tag.AccessionNumber));
s.setStudyID(studyDataset.getString(Tag.StudyID));
s.setReferringPhysicianName(studyDataset.getString(Tag.ReferringPhysicianName));
patient.addStudy(s);
}
return s;
}
示例10: store
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
@Override
protected void store(Association as,
PresentationContext pc,
Attributes rq,
PDVInputStream pin,
Attributes rsp) throws IOException
{
String tsuid = pc.getTransferSyntax();
String classUid = rq.getString(Tag.AffectedSOPClassUID);
DicomInputStream din = new DicomInputStream(pin, tsuid);
Attributes obj = din.readDataset(-1, -1);
CacheManager.writeObject(obj, tsuid, classUid);
}
示例11: writeObject
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
static void writeObject(Attributes obj, String txUid, String classUid)
throws IOException
{
String studyUid = obj.getString(Tag.StudyInstanceUID);
String seriesUid = obj.getString(Tag.SeriesInstanceUID);
String instanceUid = obj.getString(Tag.SOPInstanceUID);
File dcmFile = buildFile(studyUid, seriesUid, instanceUid, "dcm");
File tmpFile = buildFile(studyUid, seriesUid, instanceUid, "tmp");
File errFile = buildFile(studyUid, seriesUid, instanceUid, "err");
try {
if (errFile.isFile()) {
logger.info("Overwriting error file: {}", errFile);
FileUtils.deleteQuietly(errFile);
}
FileUtils.touch(tmpFile); // Create parent directories if needed
try (FileOutputStream fos = new FileOutputStream(tmpFile)) {
if (UID.ImplicitVRLittleEndian.equals(txUid)) {
// DicomOutputStream throws exception when writing dataset with LEI
txUid = UID.ExplicitVRLittleEndian;
}
else if (UID.ExplicitVRBigEndianRetired.equals(txUid)) {
// Should never happen, but just in case
txUid = UID.ExplicitVRLittleEndian;
logger.info("Trancoding dataset from big to "
+ "little endian for: {}", dcmFile);
}
Attributes fmi = Attributes.createFileMetaInformation(instanceUid,
classUid,
txUid);
DicomOutputStream dos = new DicomOutputStream(fos, txUid);
dos.writeDataset(fmi, obj);
dos.close();
}
Files.move(tmpFile.toPath(),
dcmFile.toPath(),
StandardCopyOption.ATOMIC_MOVE,
StandardCopyOption.REPLACE_EXISTING);
}
catch (Exception ex) {
logger.warn("Unable save DICOM object to: " + dcmFile, ex);
FileUtils.touch(errFile);
FileUtils.deleteQuietly(tmpFile);
FileUtils.deleteQuietly(dcmFile);
if (ex instanceof IOException) {
throw (IOException) ex;
}
else {
throw new IOException(ex);
}
}
}
示例12: doQuery
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
public List<Attributes> doQuery(QueryParameters params) throws IOException,
InterruptedException, IncompatibleConnectionException, GeneralSecurityException
{
Association assoc = connect();
try {
ResponseHandler handler = new ResponseHandler(assoc, params);
Attributes query = new Attributes();
if (params.getLevel().equals(STUDY)) {
ensure(query, REQUIRED_STUDY_ATTRIBUTE_IDS);
}
query.addAll(params.getIncludedAttributes());
query.addAll(params.getParameters());
query.setString(Tag.QueryRetrieveLevel, VR.CS, params.getLevel().name());
assoc.cfind(getSopClass(),
0,
query,
null,
handler);
return handler.results;
}
finally {
releaseGracefully();
}
}
示例13: getIntegerFromDicomElement
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
public static Integer getIntegerFromDicomElement(Attributes dicom, int tag, String privateCreatorID,
Integer defaultValue) {
if (dicom == null || !dicom.containsValue(tag)) {
return defaultValue;
}
try {
return dicom.getInt(privateCreatorID, tag, defaultValue == null ? 0 : defaultValue);
} catch (NumberFormatException e) {
LOGGER.error("Cannot parse Integer of {}: {} ", TagUtils.toString(tag), e.getMessage()); //$NON-NLS-1$
}
return defaultValue;
}
示例14: getStudyComparator
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
private static Comparator<Attributes> getStudyComparator() {
return new Comparator<Attributes>() {
@Override
public int compare(Attributes o1, Attributes o2) {
Date date1 = o1.getDate(Tag.StudyDate);
Date date2 = o2.getDate(Tag.StudyDate);
if (date1 != null && date2 != null) {
// inverse time
int rep = date2.compareTo(date1);
if (rep == 0) {
Date time1 = o1.getDate(Tag.StudyTime);
Date time2 = o2.getDate(Tag.StudyTime);
if (time1 != null && time2 != null) {
// inverse time
return time2.compareTo(time1);
}
} else {
return rep;
}
}
if (date1 == null && date2 == null) {
return o1.getString(Tag.StudyInstanceUID, "").compareTo(o2.getString(Tag.StudyInstanceUID, ""));
} else {
if (date1 == null) {
return 1;
}
if (date2 == null) {
return -1;
}
}
return 0;
}
};
}
示例15: buildFromSeriesInstanceUID
import org.dcm4che3.data.Attributes; //导入依赖的package包/类
@Override
public void buildFromSeriesInstanceUID(CommonQueryParams params, String... seriesInstanceUIDs) {
AdvancedParams advParams = advancedParams == null ? new AdvancedParams() : advancedParams;
advParams.getQueryOptions().add(QueryOption.RELATIONAL);
for (String seriesInstanceUID : seriesInstanceUIDs) {
if (!StringUtil.hasText(seriesInstanceUID)) {
continue;
}
DicomParam[] keysSeries = {
// Matching Keys
new DicomParam(Tag.SeriesInstanceUID, seriesInstanceUID),
// Return Keys
CFind.PatientID, CFind.IssuerOfPatientID, CFind.PatientName, CFind.PatientBirthDate, CFind.PatientSex,
CFind.ReferringPhysicianName, CFind.StudyDescription, CFind.StudyDate, CFind.StudyTime,
CFind.AccessionNumber, CFind.StudyInstanceUID, CFind.StudyID, CFind.Modality, CFind.SeriesNumber,
CFind.SeriesDescription };
try {
DicomState state =
CFind.process(advParams, callingNode, calledNode, 0, QueryRetrieveLevel.SERIES, keysSeries);
LOGGER.debug("C-FIND with SeriesInstanceUID {}", state.getMessage());
List<Attributes> series = state.getDicomRSP();
if (series != null && !series.isEmpty()) {
Attributes dataset = series.get(0);
Patient patient = getPatient(dataset);
Study study = getStudy(patient, dataset);
for (Attributes seriesDataset : series) {
fillInstance(seriesDataset, study);
}
}
} catch (Exception e) {
LOGGER.error("DICOM query Error of {}", getArchiveConfigName(), e);
}
}
}