@ALDAOperator(genericExecutionMode=ALL, level=STANDARD, allowBatchMode=false) public class RoiFileToCSVConverter extends MTBOperator
Each ROI in the provided input file is converted into a CSV output file. In detail, the CSV file will contain the coordinates of the contour points of the ROI in integer format. Each row contains a single point where x and y coordinates are separated by a comma.
For files with ending ".roi" containing a single ROI also a single csv file with the given output filename is written. In case of a ROI zip archive containing multiple ROIs for each ROI an individual csv file is written. The names of these files are generated by extracting the root of the given output file name, adding a unique number and finally appending ending ".csv" to the filename.
Modifier and Type | Field and Description |
---|---|
private de.unihalle.informatik.Alida.datatypes.ALDFileString |
csvFile
Output file name.
|
private static String |
operatorID
Identifier string for this operator.
|
private de.unihalle.informatik.Alida.datatypes.ALDFileString |
roiFile
Input ROI file or zip archive with ROIs.
|
Constructor and Description |
---|
RoiFileToCSVConverter()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
operate() |
void |
setCSVFile(String file)
Specify the file where to save csv data.
|
void |
setROIFile(String file)
Specify the ROI file to process.
|
private boolean |
writeRoiToFile(MTBRegion2D r,
String file)
Writes the given region to the specified file in csv format.
|
readResolve
addOperatorExecutionProgressEventListener, addParameter, addParameter, addParameterUnconditioned, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getDocumentation, getHidingMode, getInactiveParameterNames, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterDescriptorUnconditioned, getParameterNames, getParameterUnconditioned, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, hasInOutParameters, hasParameter, isAnnotatedParameter, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, removeParameter, runOp, runOp, runOp, setConstructionMode, setConstructionMode, setConstructionMode, setHidingMode, setName, setParameter, setParameterUnconditioned, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory
private static final String operatorID
@Parameter(label="Input ROI file", required=true, dataIOOrder=0, direction=IN, description="ImageJ ROI file.") private de.unihalle.informatik.Alida.datatypes.ALDFileString roiFile
@Parameter(label="Output CSV file", required=true, dataIOOrder=1, direction=IN, description="Output CSV file.") private de.unihalle.informatik.Alida.datatypes.ALDFileString csvFile
In case that the input file contains multiple ROIs, the output filename is extended by a unique number and ending "*.cvs". Note that if only a single ROI is to be written and there is no or a wrong ending given this won't be corrected here.
public RoiFileToCSVConverter() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.public void setROIFile(String file)
file
- ROI file to convert, needs to be either in roi or zip format.public void setCSVFile(String file)
file
- Filename where to save the data.protected void operate() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
operate
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
private boolean writeRoiToFile(MTBRegion2D r, String file)
r
- Region to write.file
- File to where the region is to be written.Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.