Search in sources :

Example 1 with Defacing

use of org.karnak.backend.model.profiles.Defacing in project karnak by OsiriX-Foundation.

the class Profile method applyDefacing.

public void applyDefacing(Attributes dcmCopy, AttributeEditorContext context) {
    ProfileItem profileItemDefacing = profiles.stream().filter(p -> p instanceof Defacing).findFirst().orElse(null);
    if (profileItemDefacing != null) {
        if (isCT(dcmCopy) && isAxial(dcmCopy)) {
            if (profileItemDefacing.getCondition() == null) {
                context.getProperties().setProperty(Defacer.APPLY_DEFACING, "true");
            } else {
                ExprCondition exprCondition = new ExprCondition(dcmCopy);
                boolean conditionIsOk = (Boolean) ExpressionResult.get(profileItemDefacing.getCondition(), exprCondition, Boolean.class);
                if (conditionIsOk) {
                    context.getProperties().setProperty(Defacer.APPLY_DEFACING, "true");
                }
            }
        }
    }
}
Also used : ProfileItem(org.karnak.backend.model.profiles.ProfileItem) Defacing(org.karnak.backend.model.profiles.Defacing) ExprCondition(org.karnak.backend.model.expression.ExprCondition)

Aggregations

ExprCondition (org.karnak.backend.model.expression.ExprCondition)1 Defacing (org.karnak.backend.model.profiles.Defacing)1 ProfileItem (org.karnak.backend.model.profiles.ProfileItem)1