ReadImageJROI - FUNCTION Read an ImageJ ROI into a MATLAB structure
Usage:
[sROI] = ReadImageJROI(strFilename)
[cvsROIs] = ReadImageJROI(cstrFilenames)
[cvsROIs] = ReadImageJROI(strROIArchiveFilename)
This function reads the ImageJ binary ROI file format.
'strFilename' is the full path to a '.roi' file. A list of ROI files can be passed as a cell array of filenames, in 'cstrFilenames'. An ImageJ ROI archive can be access by providing a '.zip' filename in 'strROIArchiveFilename'. Single ROIs are returned as matlab structures, with variable fields depending on the ROI type. Multiple ROIs are returned as a cell array of ROI structures.
The field '.strName' is guaranteed to exist, and contains the ROI name (the filename minus '.roi').
The field '.strType' is guaranteed to exist, and defines the ROI type: {'Rectangle', 'Oval', Line', 'Polygon', 'Freehand', 'Traced', 'PolyLine', 'FreeLine', 'Angle', 'Point', 'NoROI'}.
The field '.vnRectBounds' is guaranteed to exist, and defines the rectangular bounds of the ROI: ['nTop', 'nLeft', 'nBottom', 'nRight'].
The field '.nVersion' is guaranteed to exist, and defines the version number of the ROI format.
Other structure fields are described in the function help text.
Hint:
ROIs returned by this function can be converted into useful regions using the bwconncomp function, but this requires some extra work to draw each ROI into a matrix. |