MaskImage: IndexError: index out of range in dimension


#1

Hello.

These are 2 example image I use:


I’m getting variations of the following error:

xTraceback (most recent call last):
File “cellprofiler\pipeline.pyc”, line 1934, in run_image_set
File “cellprofiler\modules\maskimage.pyc”, line 142, in run
IndexError: index (439) out of range (0<=index<438) in dimension 0

Pipeline_Pipeline	"CellProfiler Pipeline: http://www.cellprofiler.org
Version:3
DateRevision:20140723174500
GitHash:6c2d896
ModuleCount:12
HasImagePlaneDetails:False

Images:[module_num:1|svn_version:\'Unknown\'|variable_revision_number:2|show_window:False|notes:\x5B\'To begin creating your project, use the Images module to compile a list of files and/or folders that you want to analyze. You can also specify a set of rules to include only the desired files in your selected folders.\'\x5D|batch_state:array(\x5B\x5D, dtype=uint8)|enabled:True|wants_pause:False]
    :
    Filter images?:Images only
    Select the rule criteria:and (extension does isimage) (directory doesnot containregexp ""\x5B\\\\\\\\\\\\\\\\/\x5D\\\\\\\\."")

Metadata:[module_num:2|svn_version:\'Unknown\'|variable_revision_number:4|show_window:False|notes:\x5B\'The Metadata module optionally allows you to extract information describing your images (i.e, metadata) which will be stored along with your measurements. This information can be contained in the file name and/or location, or in an external file.\'\x5D|batch_state:array(\x5B\x5D, dtype=uint8)|enabled:True|wants_pause:False]
    Extract metadata?:Yes
    Metadata data type:Text
    Metadata types:{}
    Extraction method count:1
    Metadata extraction method:Extract from file/folder names
    Metadata source:File name
    Regular expression:^(?P<patient>.*)_(?P<antibody>.*)_(?P<type>.*)_(?P<segment>.*)_(?P<picture>.*).jpg
    Regular expression:(?P<Date>\x5B0-9\x5D{4}_\x5B0-9\x5D{2}_\x5B0-9\x5D{2})$
    Extract metadata from:All images
    Select the filtering criteria:and (file does contain """")
    Metadata file location:
    Match file and image metadata:\x5B\x5D
    Use case insensitive matching?:No

NamesAndTypes:[module_num:3|svn_version:\'Unknown\'|variable_revision_number:5|show_window:False|notes:\x5B\'The NamesAndTypes module allows you to assign a meaningful name to each image by which other modules will refer to it.\'\x5D|batch_state:array(\x5B\x5D, dtype=uint8)|enabled:True|wants_pause:False]
    Assign a name to:Images matching rules
    Select the image type:Color image
    Name to assign these images:raw
    Match metadata:\x5B\x5D
    Image set matching method:Order
    Set intensity range from:Image metadata
    Assignments count:2
    Single images count:0
    Select the rule criteria:and (file doesnot contain ""mask"")
    Name to assign these images:raw
    Name to assign these objects:Cell
    Select the image type:Color image
    Set intensity range from:Image metadata
    Retain outlines of loaded objects?:No
    Name the outline image:LoadedOutlines
    Select the rule criteria:and (file does contain ""mask"")
    Name to assign these images:mask
    Name to assign these objects:Nucleus
    Select the image type:Grayscale image
    Set intensity range from:Image metadata
    Retain outlines of loaded objects?:No
    Name the outline image:LoadedOutlines

Groups:[module_num:4|svn_version:\'Unknown\'|variable_revision_number:2|show_window:False|notes:\x5B\'The Groups module optionally allows you to split your list of images into image subsets (groups) which will be processed independently of each other. Examples of groupings include screening batches, microtiter plates, time-lapse movies, etc.\'\x5D|batch_state:array(\x5B\x5D, dtype=uint8)|enabled:True|wants_pause:False]
    Do you want to group your images?:No
    grouping metadata count:1
    Metadata category:None

UnmixColors:[module_num:5|svn_version:\'Unknown\'|variable_revision_number:2|show_window:False|notes:\x5B\x5D|batch_state:array(\x5B\x5D, dtype=uint8)|enabled:True|wants_pause:False]
    Stain count:2
    Select the input color image:raw
    Name the output name:DAB
    Stain:Custom
    Red absorbance:0.367762
    Green absorbance:0.604443
    Blue absorbance:0.706682
    Name the output name:Hematoxylin
    Stain:Custom
    Red absorbance:0.51545
    Green absorbance:0.777032
    Blue absorbance:0.361294

MaskImage:[module_num:6|svn_version:\'Unknown\'|variable_revision_number:3|show_window:False|notes:\x5B\x5D|batch_state:array(\x5B\x5D, dtype=uint8)|enabled:True|wants_pause:False]
    Select the input image:DAB
    Name the output image:mask
    Use objects or an image as a mask?:Image
    Select object for mask:None
    Select image for mask:mask
    Invert the mask?:No

IdentifyPrimaryObjects:[module_num:7|svn_version:\'Unknown\'|variable_revision_number:10|show_window:False|notes:\x5B\x5D|batch_state:array(\x5B\x5D, dtype=uint8)|enabled:True|wants_pause:False]
    Select the input image:mask
    Name the primary objects to be identified:DAB_regions
    Typical diameter of objects, in pixel units (Min,Max):10,8000
    Discard objects outside the diameter range?:Yes
    Try to merge too small objects with nearby larger objects?:No
    Discard objects touching the border of the image?:No
    Method to distinguish clumped objects:None
    Method to draw dividing lines between clumped objects:None
    Size of smoothing filter:2
    Suppress local maxima that are closer than this minimum allowed distance:3
    Speed up by using lower-resolution image to find local maxima?:No
    Name the outline image:DAB_outlines
    Fill holes in identified objects?:Never
    Automatically calculate size of smoothing filter for declumping?:Yes
    Automatically calculate minimum allowed distance between local maxima?:Yes
    Retain outlines of the identified objects?:Yes
    Automatically calculate the threshold using the Otsu method?:Yes
    Enter Laplacian of Gaussian threshold:0.5
    Automatically calculate the size of objects for the Laplacian of Gaussian filter?:Yes
    Enter LoG filter diameter:5.0
    Handling of objects if excessive number of objects identified:Continue
    Maximum number of objects:500
    Threshold setting version:1
    Threshold strategy:Adaptive
    Thresholding method:Otsu
    Select the smoothing method for thresholding:Automatic
    Threshold smoothing scale:1
    Threshold correction factor:1
    Lower and upper bounds on threshold:0.2,0.6
    Approximate fraction of image covered by objects?:0.01
    Manual threshold:0.25
    Select the measurement to threshold with:None
    Select binary image:None
    Masking objects:None
    Two-class or three-class thresholding?:Two classes
    Minimize the weighted variance or the entropy?:Weighted variance
    Assign pixels in the middle intensity class to the foreground or the background?:Foreground
    Method to calculate adaptive window size:Image size
    Size of adaptive window:10

IdentifyPrimaryObjects:[module_num:8|svn_version:\'Unknown\'|variable_revision_number:10|show_window:False|notes:\x5B\x5D|batch_state:array(\x5B\x5D, dtype=uint8)|enabled:True|wants_pause:False]
    Select the input image:Hematoxylin
    Name the primary objects to be identified:Nuclei
    Typical diameter of objects, in pixel units (Min,Max):10,100
    Discard objects outside the diameter range?:Yes
    Try to merge too small objects with nearby larger objects?:No
    Discard objects touching the border of the image?:No
    Method to distinguish clumped objects:None
    Method to draw dividing lines between clumped objects:Shape
    Size of smoothing filter:3
    Suppress local maxima that are closer than this minimum allowed distance:20
    Speed up by using lower-resolution image to find local maxima?:Yes
    Name the outline image:nuclei_outlines
    Fill holes in identified objects?:After both thresholding and declumping
    Automatically calculate size of smoothing filter for declumping?:No
    Automatically calculate minimum allowed distance between local maxima?:No
    Retain outlines of the identified objects?:Yes
    Automatically calculate the threshold using the Otsu method?:Yes
    Enter Laplacian of Gaussian threshold:0.5
    Automatically calculate the size of objects for the Laplacian of Gaussian filter?:Yes
    Enter LoG filter diameter:5.0
    Handling of objects if excessive number of objects identified:Continue
    Maximum number of objects:500
    Threshold setting version:1
    Threshold strategy:Global
    Thresholding method:Otsu
    Select the smoothing method for thresholding:Automatic
    Threshold smoothing scale:1.0
    Threshold correction factor:1
    Lower and upper bounds on threshold:0.50,1.0
    Approximate fraction of image covered by objects?:0.01
    Manual threshold:0.20
    Select the measurement to threshold with:None
    Select binary image:None
    Masking objects:None
    Two-class or three-class thresholding?:Two classes
    Minimize the weighted variance or the entropy?:Weighted variance
    Assign pixels in the middle intensity class to the foreground or the background?:Foreground
    Method to calculate adaptive window size:Image size
    Size of adaptive window:10

MeasureImageAreaOccupied:[module_num:9|svn_version:\'Unknown\'|variable_revision_number:3|show_window:False|notes:\x5B\x5D|batch_state:array(\x5B\x5D, dtype=uint8)|enabled:True|wants_pause:False]
    Hidden:1
    Measure the area occupied in a binary image, or in objects?:Objects
    Select objects to measure:DAB_regions
    Retain a binary image of the object regions?:No
    Name the output binary image:binary
    Select a binary image to measure:mask

OverlayOutlines:[module_num:10|svn_version:\'Unknown\'|variable_revision_number:3|show_window:False|notes:\x5B\x5D|batch_state:array(\x5B\x5D, dtype=uint8)|enabled:True|wants_pause:False]
    Display outlines on a blank image?:No
    Select image on which to display outlines:raw
    Name the output image:OrigOverlay
    Outline display mode:Color
    Select method to determine brightness of outlines:Max of image
    Width of outlines:0.3
    Select outlines to display:DAB_outlines
    Select outline color:red
    Load outlines from an image or objects?:Image
    Select objects to display:None
    Select outlines to display:None
    Select outline color:green
    Load outlines from an image or objects?:Objects
    Select objects to display:Nuclei

SaveImages:[module_num:11|svn_version:\'Unknown\'|variable_revision_number:11|show_window:False|notes:\x5B\x5D|batch_state:array(\x5B\x5D, dtype=uint8)|enabled:True|wants_pause:False]
    Select the type of image to save:Image
    Select the image to save:OrigOverlay
    Select the objects to save:None
    Select the module display window to save:None
    Select method for constructing file names:From image filename
    Select image name for file prefix:raw
    Enter single file name:OrigBlue
    Number of digits:4
    Append a suffix to the image file name?:Yes
    Text to append to the image name:_outlines
    Saved file format:jpeg

    Image bit depth:8
    Overwrite existing files without warning?:Yes
    When to save:Every cycle
    Rescale the images? :No
    Save as grayscale or color image?:Grayscale
    Select colormap:Default
    Record the file and path information to the saved image?:No
    Create subfolders in the output folder?:No
    Base image folder:Elsewhere...\x7C
    Saved movie format:avi

ExportToSpreadsheet:[module_num:12|svn_version:\'Unknown\'|variable_revision_number:11|show_window:False|notes:\x5B\x5D|batch_state:array(\x5B\x5D, dtype=uint8)|enabled:True|wants_pause:False]
    Select the column delimiter:Tab
    Add image metadata columns to your object data file?:Yes
    Limit output to a size that is allowed in Excel?:No
    Select the measurements to export:Yes
    Calculate the per-image mean values for object measurements?:No
    Calculate the per-image median values for object measurements?:No
    Calculate the per-image standard deviation values for object measurements?:No

    Create a GenePattern GCT file?:No
    Select source of sample row name:Metadata
    Select the image to use as the identifier:None
    Select the metadata to use as the identifier:None
    Export all measurement types?:Yes
    Press button to select measurements to export:DAB_regions\x7CNumber_Object_Number,DAB_regions\x7CLocation_Center_Y,DAB_regions\x7CLocation_Center_X,Image\x7CAreaOccupied_Perimeter_DAB_regions,Image\x7CAreaOccupied_TotalArea_DAB_regions,Image\x7CAreaOccupied_AreaOccupied_DAB_regions,Image\x7CWidth_raw,Image\x7CWidth_mask,Image\x7CFileName_raw,Image\x7CFileName_mask,Image\x7CHeight_mask,Image\x7CHeight_raw,Image\x7CMetadata_picture,Image\x7CMetadata_Series,Image\x7CMetadata_FileLocation,Image\x7CMetadata_patient,Image\x7CMetadata_antibody,Image\x7CMetadata_Frame,Image\x7CMetadata_type,Image\x7CMetadata_segment,Experiment\x7CModification_Timestamp,Experiment\x7CRun_Timestamp,Experiment\x7CPipeline_Pipeline,Nuclei\x7CLocation_Center_Y,Nuclei\x7CLocation_Center_X,Nuclei\x7CNumber_Object_Number
    Representation of Nan/Inf:NaN
    Add a prefix to file names?:No
    Filename prefix\x3A:MyExpt_
    Overwrite without warning?:Yes
    Data to export:Do not use
    Combine these object measurements with those of the previous object?:No
    File name:DATA.csv
    Use the object name for the file name?:Yes
"

#2

3 things to check, in order to check them, at least from my first quick glance:

  1. Are your input images (DAB+mask) the same size in pixels?
  2. Are your input images in the same orientation- is one maybe rotated when it comes in?
  3. What happens if you change the output name in your MaskImage to something other than “mask”, as that’s one of your input image names too?

#3

The masks are essentially the same as the original images. I used the original images to mask in photoshop, and then just saved them with the addition of “mask” to the name so the geometry, orientation , size is exactly equal.

EDIT: Misunderstood your 3rd point. Will try it ASAP.


#4

Your third suggestion seemed to work. Thank you.