congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ValidationResult
Code IndexAdd Tabnine to your IDE (free)

How to use
ValidationResult
in
org.dcm4che3.data

Best Java code snippets using org.dcm4che3.data.ValidationResult (Showing top 19 results out of 315)

origin: dcm4che/dcm4che

@Override
public String toString() {
  if (isValid())
    return "VALID";
  StringBuilder sb = new StringBuilder();
  if (notAllowedAttributes != null)
    errorComment(sb, "Not allowed Attribute",
        tagsOfNotAllowedAttributes()).append(StringUtils.LINE_SEPARATOR);
  if (missingAttributes != null)
    errorComment(sb, "Missing Attribute",
        tagsOfMissingAttributes()).append(StringUtils.LINE_SEPARATOR);
  if (missingAttributeValues != null)
    errorComment(sb, "Missing Value of Attribute",
        tagsOfMissingAttributeValues()).append(StringUtils.LINE_SEPARATOR);
  if (invalidAttributeValues != null)
    errorComment(sb, "Invalid Attribute",
        tagsOfInvalidAttributeValues()).append(StringUtils.LINE_SEPARATOR);
  return sb.substring(0, sb.length()-1);
}
origin: dcm4che/dcm4che

public ValidationResult validate(IOD iod) {
  ValidationResult result = new ValidationResult();
  HashMap<String,Boolean> resolvedConditions = new HashMap<String,Boolean>();
  for (IOD.DataElement el : iod) {
    validate(el, result, resolvedConditions);
  }
  return result;
}
origin: dcm4che/dcm4che

public boolean isValid() {
  return !hasMissingAttributes()
    && !hasMissingAttributeValues()
    && !hasInvalidAttributeValues()
    && !hasNotAllowedAttributes();
}
origin: dcm4che/dcm4che

public int[] getOffendingElements() {
  return cat(tagsOfMissingAttributes(),
      tagsOfMissingAttributeValues(),
      tagsOfInvalidAttributeValues(),
      tagsOfNotAllowedAttributes());
}
origin: dcm4che/dcm4che

public String asText(Attributes attrs) {
  if (isValid())
    return "VALID";
  StringBuilder sb = new StringBuilder();
  appendTextTo(0, attrs, sb);
  return sb.substring(0, sb.length()-1);
}
origin: dcm4che/dcm4che

  public static DicomServiceException valueOf(ValidationResult result,
      Attributes attrs) {
    if (result.hasNotAllowedAttributes())
      return new DicomServiceException(Status.NoSuchAttribute)
        .setAttributeIdentifierList(result.tagsOfNotAllowedAttributes());
    if (result.hasMissingAttributes())
      return new DicomServiceException(Status.MissingAttribute)
        .setAttributeIdentifierList(result.tagsOfMissingAttributes());
    if (result.hasMissingAttributeValues())
      return new DicomServiceException(Status.MissingAttributeValue)
        .setDataset(new Attributes(attrs, result.tagsOfMissingAttributeValues()));
    if (result.hasInvalidAttributeValues())
      return new DicomServiceException(Status.InvalidAttributeValue)
        .setDataset(new Attributes(attrs, result.tagsOfInvalidAttributeValues()));
    return null;
  }
}
origin: dcm4che/dcm4che

  if (el.type == IOD.DataElementType.TYPE_1 
      || el.type == IOD.DataElementType.TYPE_2) {
    result.addMissingAttribute(el);
if (isEmpty(value)) {
  if (el.type == IOD.DataElementType.TYPE_1) {
    result.addMissingAttributeValue(el);
  result.addNotAllowedAttribute(el);
  return;
if (el.vr == VR.SQ) {
  if (!(value instanceof Sequence)) {
    result.addInvalidAttributeValue(el, ValidationResult.Invalid.VR);
    return;
  int seqSize = seq.size();
  if (el.maxVM > 0 && seqSize > el.maxVM) {
    result.addInvalidAttributeValue(el, 
        ValidationResult.Invalid.MultipleItems);
    return;
      ValidationResult itemValidationResult =
          validateCode(seq.get(i), (Code[]) validVals);
      invalidItem = invalidItem || !itemValidationResult.isValid();
      itemValidationResults[i] = itemValidationResult;
      result.addInvalidAttributeValue(el, 
          ValidationResult.Invalid.Code, itemValidationResults, null);
origin: dcm4che/dcm4che

private void appendInvalidAttributeValues(int level, Attributes attrs,
    String title, StringBuilder sb) {
  appendPrefixTo(level, sb);
  sb.append(title);
  sb.append(StringUtils.LINE_SEPARATOR);
  for (InvalidAttributeValue iav : invalidAttributeValues) {
    int tag = iav.dataElement.tag;
    appendAttribute(level, tag, sb);
    VR.Holder vr = new VR.Holder();
    Object value = attrs.getValue(tag, vr);
    if (iav.reason != Invalid.Item) {
      sb.append(" Invalid ").append(iav.reason);
      appendIODRef(iav.dataElement.getLineNumber(), sb);
        appendPrefixTo(level+1, sb);
        sb.append("Missing Item");
        appendIODRef(iod.getLineNumber(), sb);
        sb.append(StringUtils.LINE_SEPARATOR);
      for (int i = 0; i < iav.itemValidationResults.length; i++) {
        ValidationResult itemResult = iav.itemValidationResults[i];
        if (!itemResult.isValid()) {
          appendPrefixTo(level+1, sb);
          sb.append("Invalid Item ").append(i+1).append(':')
           .append(StringUtils.LINE_SEPARATOR);
          itemResult.appendTextTo(level+1, seq.get(i), sb);
origin: org.dcm4che/dcm4che-net

  private static void check(ValidationResult result) throws DicomServiceException {
    if (!result.isValid())
      throw new DicomServiceException(
          Status.IdentifierDoesNotMatchSOPClass,
          result.getErrorComment())
        .setOffendingElements(result.getOffendingElements());
  }
}
origin: dcm4che/dcm4che

public void validate(File file) {
  if (iod == null)
    throw new IllegalStateException("IOD net initialized");
  DicomInputStream dis = null;
  try {
    System.out.print("Validate: " + file + " ... ");
    dis = new DicomInputStream(file);
    Attributes attrs = dis.readDataset(-1, -1);
    ValidationResult result = attrs.validate(iod);
    if (result.isValid())
      System.out.println("OK");
    else {
      System.out.println("FAILED:");
      System.out.println(result.asText(attrs));
    }
  } catch (IOException e) {
    System.out.println("FAILED: " + e.getMessage());
  } finally {
    SafeClose.close(dis);
  }
}
origin: dcm4che/dcm4che

private ValidationResult validateCode(Attributes item, Code[] validVals) {
  ValidationResult result = null;
  for (Code code : validVals) {
    result = item.validate(IOD.valueOf(code));
    if (result.isValid())
      break;
  }
  return result;
}
origin: org.dcm4che/dcm4che-net

  public static DicomServiceException valueOf(ValidationResult result,
      Attributes attrs) {
    if (result.hasNotAllowedAttributes())
      return new DicomServiceException(Status.NoSuchAttribute)
        .setAttributeIdentifierList(result.tagsOfNotAllowedAttributes());
    if (result.hasMissingAttributes())
      return new DicomServiceException(Status.MissingAttribute)
        .setAttributeIdentifierList(result.tagsOfMissingAttributes());
    if (result.hasMissingAttributeValues())
      return new DicomServiceException(Status.MissingAttributeValue)
        .setDataset(new Attributes(attrs, result.tagsOfMissingAttributeValues()));
    if (result.hasInvalidAttributeValues())
      return new DicomServiceException(Status.InvalidAttributeValue)
        .setDataset(new Attributes(attrs, result.tagsOfInvalidAttributeValues()));
    return null;
  }
}
origin: dcm4che/dcm4che

public String getErrorComment() {
  StringBuilder sb = new StringBuilder();
  if (notAllowedAttributes != null)
    return errorComment(sb, "Not allowed Attribute",
        tagsOfNotAllowedAttributes()).toString();
  if (missingAttributes != null)
    return errorComment(sb, "Missing Attribute",
        tagsOfMissingAttributes()).toString();
  if (missingAttributeValues != null)
    return errorComment(sb, "Missing Value of Attribute",
        tagsOfMissingAttributeValues()).toString();
  if (invalidAttributeValues != null)
    return errorComment(sb, "Invalid Attribute",
        tagsOfInvalidAttributeValues()).toString();
  return null;
}
origin: dcm4che/dcm4che

  private static void check(ValidationResult result) throws DicomServiceException {
    if (!result.isValid())
      throw new DicomServiceException(
          Status.IdentifierDoesNotMatchSOPClass,
          result.getErrorComment())
        .setOffendingElements(result.getOffendingElements());
  }
}
origin: org.dcm4che.tool/dcm4che-tool-dcmvalidate

public void validate(File file) {
  if (iod == null)
    throw new IllegalStateException("IOD net initialized");
  DicomInputStream dis = null;
  try {
    System.out.print("Validate: " + file + " ... ");
    dis = new DicomInputStream(file);
    Attributes attrs = dis.readDataset(-1, -1);
    ValidationResult result = attrs.validate(iod);
    if (result.isValid())
      System.out.println("OK");
    else {
      System.out.println("FAILED:");
      System.out.println(result.asText(attrs));
    }
  } catch (IOException e) {
    System.out.println("FAILED: " + e.getMessage());
  } finally {
    SafeClose.close(dis);
  }
}
origin: dcm4che/dcm4che

if (mppsNCreateIOD != null) {
  ValidationResult result = rqAttrs.validate(mppsNCreateIOD);
  if (!result.isValid())
    throw DicomServiceException.valueOf(result, rqAttrs);
origin: dcm4che/dcm4che

if (mppsNSetIOD != null) {
  ValidationResult result = rqAttrs.validate(mppsNSetIOD);
  if (!result.isValid())
    throw DicomServiceException.valueOf(result, rqAttrs);
origin: org.dcm4che/dcm4che-net

public static QueryRetrieveLevel valueOf(Attributes attrs,
    String[] qrLevels) throws DicomServiceException {
  ValidationResult result = new ValidationResult();
  attrs.validate(new IOD.DataElement(Tag.QueryRetrieveLevel, VR.LO,
      IOD.DataElementType.TYPE_1, 1, 1, 0).setValues(qrLevels),
      result);
  check(result);
  return QueryRetrieveLevel.valueOf(attrs.getString(Tag.QueryRetrieveLevel));
}
origin: dcm4che/dcm4che

public static QueryRetrieveLevel valueOf(Attributes attrs,
    String[] qrLevels) throws DicomServiceException {
  ValidationResult result = new ValidationResult();
  attrs.validate(new IOD.DataElement(Tag.QueryRetrieveLevel, VR.LO,
      IOD.DataElementType.TYPE_1, 1, 1, 0).setValues(qrLevels),
      result);
  check(result);
  return QueryRetrieveLevel.valueOf(attrs.getString(Tag.QueryRetrieveLevel));
}
org.dcm4che3.dataValidationResult

Most used methods

  • isValid
  • <init>
  • hasInvalidAttributeValues
  • hasMissingAttributeValues
  • hasMissingAttributes
  • hasNotAllowedAttributes
  • tagsOfInvalidAttributeValues
  • tagsOfMissingAttributeValues
  • tagsOfMissingAttributes
  • tagsOfNotAllowedAttributes
  • addInvalidAttributeValue
  • addMissingAttribute
  • addInvalidAttributeValue,
  • addMissingAttribute,
  • addMissingAttributeValue,
  • addNotAllowedAttribute,
  • appendAttribute,
  • appendIODRef,
  • appendInvalidAttributeValues,
  • appendPrefixTo,
  • appendTextTo,
  • asText

Popular in Java

  • Running tasks concurrently on multiple threads
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • startActivity (Activity)
  • runOnUiThread (Activity)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now