Class OperationServiceImpl
java.lang.Object
uk.ac.diamond.scisoft.analysis.processing.OperationServiceImpl
- All Implemented Interfaces:
IOperationService
Do not use this class externally. Instead get the IOperationService
from OSGI.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionIOperation<? extends IOperationModel, ? extends OperationData> Creates an operation by using its type.Creates an operation bean for use with remote/headless processingCreates an empty context You must set at least the data, slicing and series of operations on this context.voidcreateOperations(Class<?> c, String pkg) Call this method to load some operations not by extension point but by parsing the classes in a package which implement IOperation.voidexecute(IOperationContext context) Uses the Slicer.visitAll(...) method which conversions also use to process stacks out of the rich dataset passed in.Collection<IOperation<? extends IOperationModel, ? extends OperationData>> Finds all operations by doing a search using the regex passed in.Collection<IOperation<? extends IOperationModel, ? extends OperationData>> find(OperationRank rank, boolean isInput) Finds all operations with either the input rank or output rank (when isInput=false) is passed in.IOperation<? extends IOperationModel, ? extends OperationData> Finds the first operation matching a search using the regex passed in.Map<String, Collection<IOperation<? extends IOperationModel, ? extends OperationData>>> Get operations by category.getCategory(String operationId) Return the category a the operation with the specified id belongs togetDescription(String id) Get the description of the operation with this IDClass<? extends IOperationModel> getModelClass(String operationId) Checks the extension point for the model class pertinent to this operation.Get the name of the operation with this IDGets the IDs of all the operations.protected static booleanisCompatible(int[] ashape, int[] bshape) voidvoidvalidate(org.eclipse.january.dataset.IDataset firstSlice, IOperation<? extends IOperationModel, ? extends OperationData>... series) Checks that the pipeline passed in has a reasonable rank (for instance)
-
Constructor Details
-
OperationServiceImpl
public OperationServiceImpl()
-
-
Method Details
-
setOperationRunner
-
createContext
Description copied from interface:IOperationServiceCreates an empty context You must set at least the data, slicing and series of operations on this context.- Specified by:
createContextin interfaceIOperationService- Returns:
- context
-
execute
Uses the Slicer.visitAll(...) method which conversions also use to process stacks out of the rich dataset passed in.- Specified by:
executein interfaceIOperationService- Parameters:
context-- Throws:
OperationException
-
validate
public void validate(org.eclipse.january.dataset.IDataset firstSlice, IOperation<? extends IOperationModel, ? extends OperationData>... series) throws InvalidRankException, OperationExceptionChecks that the pipeline passed in has a reasonable rank (for instance)- Specified by:
validatein interfaceIOperationService- Parameters:
firstSlice- - may be null, image assumed if it isseries-- Throws:
InvalidRankExceptionOperationException
-
isCompatible
protected static boolean isCompatible(int[] ashape, int[] bshape) -
getModelClass
Description copied from interface:IOperationServiceChecks the extension point for the model class pertinent to this operation.- Specified by:
getModelClassin interfaceIOperationService- Returns:
- IOperation
- Throws:
Exception
-
getCategory
Description copied from interface:IOperationServiceReturn the category a the operation with the specified id belongs to- Specified by:
getCategoryin interfaceIOperationService- Parameters:
operationId-- Returns:
- category
-
find
public Collection<IOperation<? extends IOperationModel,? extends OperationData>> find(String regex) throws Exception Description copied from interface:IOperationServiceFinds all operations by doing a search using the regex passed in. All operations whose descriptions/IDs match the regex are returned. For instance:find("correction"); // Might give operations "Dark correction", "Flat correction" find("integration"); // Might give operations "Azimuthal integration", "Radial integration", "Box integration", "Line integration"NOTE the regex will be matched as follows on the ID of the operation:- if matching on the ID
- if matching the description in lower case
- if indexOf the regex in the ID is >0
- if indexOf the regex in the description is >0
- Specified by:
findin interfaceIOperationService- Parameters:
regex-- Returns:
- list of operations which match
- Throws:
Exception
-
find
public Collection<IOperation<? extends IOperationModel,? extends OperationData>> find(OperationRank rank, boolean isInput) throws Exception Description copied from interface:IOperationServiceFinds all operations with either the input rank or output rank (when isInput=false) is passed in. If rank of ANY is used then only those matching exactly ANY are returned, not all operations. If rank of SAME is used then only those matching exactly SAME are returned, not all operations.- Specified by:
findin interfaceIOperationService- Parameters:
rank-isInput- - true to search inputs, false to search outputs.- Returns:
- list of operations which match
- Throws:
Exception
-
findFirst
public IOperation<? extends IOperationModel,? extends OperationData> findFirst(String regex) throws Exception Description copied from interface:IOperationServiceFinds the first operation matching a search using the regex passed in. All operations whose descriptions/IDs match the regex are returned. For instance:find("correction"); // Might give operations "Dark correction", "Flat correction" find("integration"); // Might give operations "Azimuthal integration", "Radial integration", "Box integration", "Line integration"NOTE the regex will be matched as follows on the ID of the operation:- if matching on the ID
- if matching the description in lower case
- if indexOf the regex in the ID is >0
- if indexOf the regex in the description is >0
- Specified by:
findFirstin interfaceIOperationService- Parameters:
regex-- Returns:
- operation which match
- Throws:
Exception
-
getRegisteredOperations
Description copied from interface:IOperationServiceGets the IDs of all the operations. The id is defined in the extension point.- Specified by:
getRegisteredOperationsin interfaceIOperationService- Returns:
- all the IDs which have been contributed via extensions
- Throws:
Exception
-
getCategorizedOperations
public Map<String,Collection<IOperation<? extends IOperationModel, getCategorizedOperations() throws Exception? extends OperationData>>> Description copied from interface:IOperationServiceGet operations by category.- Specified by:
getCategorizedOperationsin interfaceIOperationService- Returns:
- a Map of operations by category. Sorted alphabetically the key is the category description. Uncategorized operations appear at the end.
- Throws:
Exception
-
create
public IOperation<? extends IOperationModel,? extends OperationData> create(String operationId) throws Exception Description copied from interface:IOperationServiceCreates an operation by using its type. This method will create a new operation using the no argument constructor.- Specified by:
createin interfaceIOperationService- Returns:
- IOperation
- Throws:
Exception
-
createOperations
Description copied from interface:IOperationServiceCall this method to load some operations not by extension point but by parsing the classes in a package which implement IOperation. This is useful if your code for the operations is not eclipse or you are writing a unit test.- Specified by:
createOperationsin interfaceIOperationService- Parameters:
c- class to use to find class loader or bundlepkg- separated by dots.- Throws:
Exception
-
getName
Description copied from interface:IOperationServiceGet the name of the operation with this ID- Specified by:
getNamein interfaceIOperationService- Parameters:
id-- Returns:
- name
- Throws:
Exception
-
getDescription
Description copied from interface:IOperationServiceGet the description of the operation with this ID- Specified by:
getDescriptionin interfaceIOperationService- Parameters:
id-- Returns:
- description
- Throws:
Exception
-
createBean
Description copied from interface:IOperationServiceCreates an operation bean for use with remote/headless processing- Specified by:
createBeanin interfaceIOperationService- Returns:
- operationBean
-