Code covered by the BSD License  

Highlights from
Import ImageJ ROIs

5.0

5.0 | 1 rating Rate this file 16 Downloads (last 30 days) File Size: 4.37 KB File ID: #32479
image thumbnail

Import ImageJ ROIs

by Dylan Muir

 

09 Aug 2011 (Updated 07 Nov 2011)

Read ROIs and ROI sets saved from ImageJ into MATLAB, without java.

| Watch this File

File Information
Description

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.

MATLAB release MATLAB 7.9 (2009b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
10 Aug 2011 Jean-Yves Tinevez  
10 Aug 2011 Jean-Yves Tinevez

Does what it says, and does it right. The function is well documented and cover all ROI types well.
There is just a minor warning coming from line 157, because of the capitalized FILESEP...

10 Aug 2011 Dylan Muir

Thanks for the comment; I must have that warning switched off! I'll fix it next version.

Please login to add a comment or rating.
Updates
16 Aug 2011

Fixed the warning about capitalised FILESEP.

16 Aug 2011

Updated screenshot

29 Aug 2011

Fixed a bug reported by Benjamin Ricca

07 Nov 2011

Updated description

Tag Activity for this File
Tag Applied By Date/Time
data import Dylan Muir 09 Aug 2011 16:08:16
image processing Dylan Muir 09 Aug 2011 16:08:16
imagej Dylan Muir 09 Aug 2011 16:08:16
data import Changfu 01 Oct 2011 12:40:02

Contact us at files@mathworks.com