EBImage cell segmentation, segmentation polygon saved to a Spatial Polygons
So I'm trying to connect EBImage output into 'sp' package to create a custom shape file (or SpatialPolygonDataFrame object).
Using the demo example from EBImage for cell segmentation, I am trying to output the polygonal segmentation into a 'SpatialPolygonDataFrame'.
The tricky part is that EBImage creates the polygon for me and stores into a large array.
How can I use this polygonal information/segmentation and create a 'SpatialPolygonDataFrame' using this example data?
The EBImage segmentation has a 510X510 RGB array for 4 images. The segmentation creates the desired polygonal boundary. Is it possible to use this polygonal boundary as a shape file for spatial analysis in the package 'sp' ?
nuc = readImage(system.file('images', 'nuclei.tif',
package='EBImage'))
cel = readImage(system.file('images', 'cells.tif',
package='EBImage'))
cells = rgbImage(green=1.5*cel, blue=nuc)
display(cells, all = TRUE)
nmask = thresh(nuc, w=10, h=10, offset=0.05)
nmask = opening(nmask, makeBrush(5, shape='disc'))
nmask = fillHull(nmask)
nmask = bwlabel(nmask)
display(nmask, all=TRUE)
ctmask = opening(cel>0.1, makeBrush(5, shape='disc'))
cmask = propagate(cel, seeds=nmask, mask=ctmask)
display(ctmask, all=TRUE)
segmented = paintObjects(cmask, cells, col='#ff00ff')
segmented = paintObjects(nmask, segmented, col='#ffff00')
display(segmented, all=TRUE)
> segmented
Image
colorMode : Color
storage.mode : double
dim : 510 510 3 4
frames.total : 12
frames.render: 4
imageData(object)[1:5,1:6,1,1]
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0 0 0 1 0 0
[2,] 0 0 0 1 0 0
[3,] 0 0 0 0 1 0
[4,] 0 0 0 0 0 1
[5,] 0 0 0 0 0 1
dim(imageData(segmented))
510 510 3 4
image-processing spatial sp
add a comment |
So I'm trying to connect EBImage output into 'sp' package to create a custom shape file (or SpatialPolygonDataFrame object).
Using the demo example from EBImage for cell segmentation, I am trying to output the polygonal segmentation into a 'SpatialPolygonDataFrame'.
The tricky part is that EBImage creates the polygon for me and stores into a large array.
How can I use this polygonal information/segmentation and create a 'SpatialPolygonDataFrame' using this example data?
The EBImage segmentation has a 510X510 RGB array for 4 images. The segmentation creates the desired polygonal boundary. Is it possible to use this polygonal boundary as a shape file for spatial analysis in the package 'sp' ?
nuc = readImage(system.file('images', 'nuclei.tif',
package='EBImage'))
cel = readImage(system.file('images', 'cells.tif',
package='EBImage'))
cells = rgbImage(green=1.5*cel, blue=nuc)
display(cells, all = TRUE)
nmask = thresh(nuc, w=10, h=10, offset=0.05)
nmask = opening(nmask, makeBrush(5, shape='disc'))
nmask = fillHull(nmask)
nmask = bwlabel(nmask)
display(nmask, all=TRUE)
ctmask = opening(cel>0.1, makeBrush(5, shape='disc'))
cmask = propagate(cel, seeds=nmask, mask=ctmask)
display(ctmask, all=TRUE)
segmented = paintObjects(cmask, cells, col='#ff00ff')
segmented = paintObjects(nmask, segmented, col='#ffff00')
display(segmented, all=TRUE)
> segmented
Image
colorMode : Color
storage.mode : double
dim : 510 510 3 4
frames.total : 12
frames.render: 4
imageData(object)[1:5,1:6,1,1]
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0 0 0 1 0 0
[2,] 0 0 0 1 0 0
[3,] 0 0 0 0 1 0
[4,] 0 0 0 0 0 1
[5,] 0 0 0 0 0 1
dim(imageData(segmented))
510 510 3 4
image-processing spatial sp
add a comment |
So I'm trying to connect EBImage output into 'sp' package to create a custom shape file (or SpatialPolygonDataFrame object).
Using the demo example from EBImage for cell segmentation, I am trying to output the polygonal segmentation into a 'SpatialPolygonDataFrame'.
The tricky part is that EBImage creates the polygon for me and stores into a large array.
How can I use this polygonal information/segmentation and create a 'SpatialPolygonDataFrame' using this example data?
The EBImage segmentation has a 510X510 RGB array for 4 images. The segmentation creates the desired polygonal boundary. Is it possible to use this polygonal boundary as a shape file for spatial analysis in the package 'sp' ?
nuc = readImage(system.file('images', 'nuclei.tif',
package='EBImage'))
cel = readImage(system.file('images', 'cells.tif',
package='EBImage'))
cells = rgbImage(green=1.5*cel, blue=nuc)
display(cells, all = TRUE)
nmask = thresh(nuc, w=10, h=10, offset=0.05)
nmask = opening(nmask, makeBrush(5, shape='disc'))
nmask = fillHull(nmask)
nmask = bwlabel(nmask)
display(nmask, all=TRUE)
ctmask = opening(cel>0.1, makeBrush(5, shape='disc'))
cmask = propagate(cel, seeds=nmask, mask=ctmask)
display(ctmask, all=TRUE)
segmented = paintObjects(cmask, cells, col='#ff00ff')
segmented = paintObjects(nmask, segmented, col='#ffff00')
display(segmented, all=TRUE)
> segmented
Image
colorMode : Color
storage.mode : double
dim : 510 510 3 4
frames.total : 12
frames.render: 4
imageData(object)[1:5,1:6,1,1]
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0 0 0 1 0 0
[2,] 0 0 0 1 0 0
[3,] 0 0 0 0 1 0
[4,] 0 0 0 0 0 1
[5,] 0 0 0 0 0 1
dim(imageData(segmented))
510 510 3 4
image-processing spatial sp
So I'm trying to connect EBImage output into 'sp' package to create a custom shape file (or SpatialPolygonDataFrame object).
Using the demo example from EBImage for cell segmentation, I am trying to output the polygonal segmentation into a 'SpatialPolygonDataFrame'.
The tricky part is that EBImage creates the polygon for me and stores into a large array.
How can I use this polygonal information/segmentation and create a 'SpatialPolygonDataFrame' using this example data?
The EBImage segmentation has a 510X510 RGB array for 4 images. The segmentation creates the desired polygonal boundary. Is it possible to use this polygonal boundary as a shape file for spatial analysis in the package 'sp' ?
nuc = readImage(system.file('images', 'nuclei.tif',
package='EBImage'))
cel = readImage(system.file('images', 'cells.tif',
package='EBImage'))
cells = rgbImage(green=1.5*cel, blue=nuc)
display(cells, all = TRUE)
nmask = thresh(nuc, w=10, h=10, offset=0.05)
nmask = opening(nmask, makeBrush(5, shape='disc'))
nmask = fillHull(nmask)
nmask = bwlabel(nmask)
display(nmask, all=TRUE)
ctmask = opening(cel>0.1, makeBrush(5, shape='disc'))
cmask = propagate(cel, seeds=nmask, mask=ctmask)
display(ctmask, all=TRUE)
segmented = paintObjects(cmask, cells, col='#ff00ff')
segmented = paintObjects(nmask, segmented, col='#ffff00')
display(segmented, all=TRUE)
> segmented
Image
colorMode : Color
storage.mode : double
dim : 510 510 3 4
frames.total : 12
frames.render: 4
imageData(object)[1:5,1:6,1,1]
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0 0 0 1 0 0
[2,] 0 0 0 1 0 0
[3,] 0 0 0 0 1 0
[4,] 0 0 0 0 0 1
[5,] 0 0 0 0 0 1
dim(imageData(segmented))
510 510 3 4
image-processing spatial sp
image-processing spatial sp
asked Nov 19 '18 at 23:41
sophie-germainsophie-germain
2372418
2372418
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384233%2febimage-cell-segmentation-segmentation-polygon-saved-to-a-spatial-polygons%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384233%2febimage-cell-segmentation-segmentation-polygon-saved-to-a-spatial-polygons%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown