Class PathClassTools
PathClass objects.- 
Method SummaryModifier and TypeMethodDescriptionstatic booleancontainsName(PathClass pathClass, String name) Query whether aPathClassor any of its ancestor classes contains a specified name.static PathClassgetNonIntensityAncestorClass(PathClass pathClass) Get the first ancestor class that is not an intensity class (i.e.static booleanisGradedIntensityClass(PathClass pathClass) Return true if the PathClass represents a built-in intensity class.static booleanisIgnoredClass(PathClass pathClass) Return true if the PathClass should be ignored from some operations, or is null.static booleanisNegativeClass(PathClass pathClass) Return true if the PathClass has the name "Negative".static booleanisNullClass(PathClass pathClass) Return true if the PathClass is null, its name is null or if it is equal to the special case of 'Unclassified' path object.static booleanReturns true if the name of the class is "1+", indicating a weakly-positive staining.static booleanisPositiveClass(PathClass pathClass) Returntrueif the PathClass has the name "Positive".static booleanisPositiveOrGradedIntensityClass(PathClass pathClass) Return true if the name of the class is "Positive", "1+", "2+" or "3+", indicating positive staining.static booleanisThreePlus(PathClass pathClass) Return true if the name of the class is "3+", indicating a weakly-positive staining.static booleanReturn true if the name of the class is "2+", indicating a moderately-positive staining.static booleanisValidClass(PathClass pathClass) Returns true if the PathClass represents a valid (non-null) classification.static PathClassmergeClasses(PathClass baseClass, PathClass additionalClass) Merge two classifications together.static PathClassremoveNames(PathClass pathClass, String... namesToRemove) Create aPathClasswith specific name elements removed (if present) from an existing classification.static PathClassremoveNames(PathClass pathClass, Collection<String> namesToRemove) Create aPathClasswith specific name elements removed (if present) from an existing classification.static PathClassCreate aPathClasswith name elements sorted alphabetically.static PathClasssortNames(PathClass pathClass, Comparator<String> comparator) Create aPathClasswith name elements sorted using an arbitraryComparator.splitNames(PathClass pathClass) Get a list containing the names of all constituent parts of aPathClass.static PathClassuniqueNames(PathClass pathClass) Remove duplicate names from a derivedPathClass.
- 
Method Details- 
isGradedIntensityClassReturn true if the PathClass represents a built-in intensity class. Here, this means its name is equal to "1+", "2+" or "3+".- Parameters:
- pathClass-
- Returns:
 
- 
isIgnoredClassReturn true if the PathClass should be ignored from some operations, or is null. In practice, this checks if the PathClass is null or if the name is either null or ends with an asterisk. It is useful to avoid generating objects for certain classes (e.g. Ignore*, Artefact*, Background*) where these would not be meaningful.Warning: the 'ignored' status is ambiguous if the PathClass is null. In a future version this method may throw an exception rather than accepting null classifications. Code that calls this method therefore should explicitly handle cases where the PathClass is null (or its name is null) to avoid ambiguity and potential exceptions in the future. - Parameters:
- pathClass-
- Returns:
- See Also:
 
- 
isNullClassReturn true if the PathClass is null, its name is null or if it is equal to the special case of 'Unclassified' path object.- Parameters:
- pathClass-
- Returns:
 
- 
isValidClassReturns true if the PathClass represents a valid (non-null) classification.- Parameters:
- pathClass- input classification to check
- Returns:
- true if the input represents a valid classification, or false if the input is null or is equivalent to PathClass.NULL_CLASS.
 
- 
isOnePlusReturns true if the name of the class is "1+", indicating a weakly-positive staining.- Parameters:
- pathClass-
- Returns:
 
- 
isTwoPlusReturn true if the name of the class is "2+", indicating a moderately-positive staining.- Parameters:
- pathClass-
- Returns:
 
- 
isThreePlusReturn true if the name of the class is "3+", indicating a weakly-positive staining.- Parameters:
- pathClass-
- Returns:
 
- 
isPositiveClassReturntrueif the PathClass has the name "Positive".- Parameters:
- pathClass-
- Returns:
 
- 
isPositiveOrGradedIntensityClassReturn true if the name of the class is "Positive", "1+", "2+" or "3+", indicating positive staining.- Parameters:
- pathClass-
- Returns:
 
- 
isNegativeClassReturn true if the PathClass has the name "Negative".- Parameters:
- pathClass-
- Returns:
 
- 
getNonIntensityAncestorClassGet the first ancestor class that is not an intensity class (i.e. not negative, positive, 1+, 2+ or 3+).This will return null if pathClass is null or if no non-intensity class was found (e.g. 'Positive' instead of 'Tumor: Positive'). - Parameters:
- pathClass-
- Returns:
 
- 
splitNamesGet a list containing the names of all constituent parts of aPathClass.- Parameters:
- pathClass- the- PathClassto split
- Returns:
- an empty list if the class has no name or is null, otherwise an ordered list containing 
 the result of calling PathClass.getName()for all derived classes, starting from the root.
 
- 
uniqueNamesRemove duplicate names from a derivedPathClass.
- 
sortNamesCreate aPathClasswith name elements sorted alphabetically. This can be useful when comparing classifications that may have been derived independently, and where the name order is unimportant.
- 
sortNamesCreate aPathClasswith name elements sorted using an arbitraryComparator. This can be useful when comparing classifications that may have been derived independently, and where the name order is unimportant.
- 
removeNamesCreate aPathClasswith specific name elements removed (if present) from an existing classification.
- 
removeNamesCreate aPathClasswith specific name elements removed (if present) from an existing classification.
- 
mergeClassesMerge two classifications together. Specifically, the name components of the additional class that are not already contained within the base class will be appended, deriving a new class as required.Note that if the additional class contains duplicate names these will not automatically be stripped unless they are also present within the base class; use uniqueNames(PathClass)if this is required.- Parameters:
- baseClass- base class, all name components will be retained
- additionalClass-
- Returns:
- the merged classification, or null if both input classes are null
 
- 
containsNameQuery whether aPathClassor any of its ancestor classes contains a specified name.For example a class "CD3: CD8"would return true for the name "CD3" or "CD8", but not anything else.- Parameters:
- pathClass- the classification to test
- name- the name to search for
- Returns:
- true if the name is found, false otherwise
 
 
-