Comments (10)
Cool that it finally worked!
"Intensity_MaxIntensityEdge_DistanceImage are the actually minimal distance of any pixel of a specific cell to the blood vessel, and vice versa?"
That sounds correct!
"""Beside, I also curious about the cellid problem, would the cellid/number of a specific image change in different cellprofiler mask with identical parameter?""
Hm if I understand you right, your question is, if the 'Image number' are linked to the 'ObjectNumber'.
In CellProfiler each image is given a number before anything is processed. Given you load the same mask/process the data with the same parameters, Object numbers should not change. The Object number should not depend on the 'Image Number' an image is given but really just on the input images.
from imcsegmentationpipeline.
This would be achieved by:
- Adapt the jupyter notebook (around : 'Other Input (only change if really necessary and you know what your doing)' )
'suffix_isletseg = '_isletseg'
csv_pannel_isletseg = 'isletseg;
list_analysis_stacks =[
(csv_pannel_ilastik, suffix_ilastik, 1),
(csv_pannel_full, suffix_full, 0),
(csv_pannel_isletseg, suffix_isletseg, 1)
]
and add 'isletseg' in your panel as a 0/1 column indicating which channels to use.
-
Add create a cellprofiler pipeline similar to '1_prepare_ilastik.cppipe` that takes the '_isletseg' stack and exports it as .h5 for ilastik.
-> For tissue level segmentation I would rather not take crops as blood vessels etc might be rare
-> I also would not scale the images 2x, as for tissue level segmentation the additional accuracy is not required -
create an ilastik pixel classifier with classes 'blood vessel', 'islets', 'other', train and export the probability maps.
-
Import the probability map in cellprofiler.:
-
Use 'ColorToGray' to e.g. get the Islets probability (e.g. channel 2)
-
Use the 'Threshold' module to threshold the 'islet' probability into a binary mask
-
Use our 'Transform Binary' module on this thresholded image ('https://github.com/BodenmillerGroup/ImcPluginsCP/blob/master/plugins/transformbinary.py)
-> This will create an image where 'The distance to a nonzero pixel will be positive, while the distance to a zero pixel will be a negative number'
-> This gives you the 'distance to the 'islet' border -
Measure this new image using your mask to get the quantifications in your Cellprofiler output.
Does this make sense?
from imcsegmentationpipeline.
I tried to use ilastik to do pixel classification as you mentioned. But after I have skip the 'resize' and 'crop bb' model of '1_prepare_ilastik.cppipe', I found the image in ilastik just changed, for example, in the first pixel classification figure a blood vessel was in the bottom, while it moved to the middle of the figure this time. Does this influence the further mask?
Besides, I was still confused why you separately mask the islets or blood vessel, and in which step and how to merge the 2 masks into one.
And about the 4th part you mentioned, is it similar to 2_segment_ilastik
& 3_measure_mask_basic
pipeline, can I just revise to adjust the islets segmentation or have to construct a brand new pipeline to deal with it. Did you have such a pipeline public or online? an example should be appreciatd.
Thank you,
Funan
from imcsegmentationpipeline.
Sorry for not being more responsive, I am running against a deadline for a paper submission before going for holidays.
Sorry for this erorr, this is because I havent adapted the visualization for this module to Cellprofiler 3 - the solution is simply to close the 'eye', such that Cellprofiler doesnt try to show the results
In addition, I still can't figure out in which step to merge these 2 mask(cell segmentation & tissue-level segmentation) into a final one.
You wouldn't merge the masks, but you would either:
- Measure the binary image after tresholding the probabilities and 'Measure' the intensity of this image -> this will show you if the cells are inside or outside the mask
- Measure the distance transformed image -
(Either do the distance transform directly in the 'Measure mask pipline' or save it out.
Note that for saving you need to use the rescale intensity module with a manual value of '65535` and save a floating point image -> the distances will then be allways scaled by 65535
-> Also measure this image, positive Mean Intensiy = cell inside the mask, negative intensity = cell outside the mask - Identify real masks for vessels using 'identify primary objects' and use 'relate objects' to relate your cells to these maks. (would be saved in the object realtions.csv)
At your Histocat question (https://github.com/BodenmillerGroup/histoCAT/issues/55#issuecomment-641672284):
Not tested but I think for histocat you would simply save the distance transformed/binary image in the same naming format as your images - histocat should then also quantify these and again the Intensity value will be indicative if a cell is inside/outside of a tissue level mask.
Using the gating functionality, you could then easily identify cells inside these tissue level maks).
Here also a rough example how to achieve this:
(note this needs ImcPluginsCP)
distance_to_mask_example.zip
Also answers question from #40
from imcsegmentationpipeline.
Sorry for not being more responsive, I am running against a deadline for a paper submission before going for holidays.
Sorry for this erorr, this is because I havent adapted the visualization for this module to Cellprofiler 3 - the solution is simply to close the 'eye', such that Cellprofiler doesnt try to show the results
In addition, I still can't figure out in which step to merge these 2 mask(cell segmentation & tissue-level segmentation) into a final one.
You wouldn't merge the masks, but you would either:
- Measure the binary image after tresholding the probabilities and 'Measure' the intensity of this image -> this will show you if the cells are inside or outside the mask
- Measure the distance transformed image -
(Either do the distance transform directly in the 'Measure mask pipline' or save it out.
Note that for saving you need to use the rescale intensity module with a manual value of '65535` and save a floating point image -> the distances will then be allways scaled by 65535
-> Also measure this image, positive Mean Intensiy = cell inside the mask, negative intensity = cell outside the mask- Identify real masks for vessels using 'identify primary objects' and use 'relate objects' to relate your cells to these maks. (would be saved in the object realtions.csv)
At your Histocat question (BodenmillerGroup/histoCAT#55 (comment)):
Not tested but I think for histocat you would simply save the distance transformed/binary image in the same naming format as your images - histocat should then also quantify these and again the Intensity value will be indicative if a cell is inside/outside of a tissue level mask.
Using the gating functionality, you could then easily identify cells inside these tissue level maks).Here also a rough example how to achieve this:
(note this needs ImcPluginsCP)
distance_to_mask_example.zipAlso answers question from #40
Hi Vito,
Thank you for your reply.
I have tried several methods before, like using MaskImage to mask RescaledCell
(from 2_segment_ilastik) on the intensity image of the Transform Binary
, actually it can't save as a distance from cell to BV. As you mentioned above, I tried to identify Vessel object using rescaledintensity and calculate the minimum distance between 2 objects(Vessel object [parent] & previous identified RescaledCell [child] ). An error occurred here:
Error while processing RelateObjects: u'None'
seems like many cells can't calculate the distance?
It's also weird that in the final cells.csv, only a small amount of cells have a minimun distance to BV even in a image that identified as least 1 blood vessel.
Beside, I also curious about the cellid problem, would the cellid/number of a specific image change in different cellprofiler mask with identical parameter?
Anyway, thank you again, helped me a lot. Good luck to your submission,
Funan
from imcsegmentationpipeline.
The Intensity Image
from Transform Binary
gives you an image where the value of each pixel is the distance to the border Blood Vessel/background.
As said you can either:
- save this image and use it as an additional channel image for HistoCAT
- measure your 'RescaledCell' with the
Measure Object Intensity
module, you will get a table where the 'MeanIntensity' of the 'Transformed' image corresponds to the distance to the interface.
This can be saved with 'ExportToSpreadsheet'.
Hope this helps
from imcsegmentationpipeline.
The
Intensity Image
fromTransform Binary
gives you an image where the value of each pixel is the distance to the border Blood Vessel/background.As said you can either:
- save this image and use it as an additional channel image for HistoCAT
- measure your 'RescaledCell' with the
Measure Intensity
module, you will get a table where the 'MeanIntensity' of the 'Transformed' image corresponds to the distance to the interface.
This can be saved with 'ExportToSpreadsheet'.Hope this helps
But the MeanIntensity
isn't what I want. Actually I'd hope to calculate the distance of each cells to the blood vessel surface. I thought the RelateObjects
might be more appropriate.
And after 'ExportToSpreadsheet', the rescaledcells.csv only got 5 columns like this ,didn't include the 'distance' column
from imcsegmentationpipeline.
You need to take the MeasureObjectIntensity module to measure the image (the one from 'Transform Binary') in the objects (eg Rescaled Cells):
http://d1zymp9ayga15t.cloudfront.net/content/Documentation/cp2.1_2.2manual/MeasureObjectIntensity.html
"distance of each cells" is not an precise term, that's why it makes sense to not only have a single distance measurement.
Measuring the 'transformed' image, where each pixel represents the distance to the bloodvessel border, allows you to get:
- average distance of all the pixels to the bloodvessel border (=MeanIntensity)
- minimal distance of any pixel to the bloodvessel border
- maximum distance of any pixel
- median distance of any pixel (=MedianIntensity)
from imcsegmentationpipeline.
You need to take the MeasureObjectIntensity module to measure the image (the one from 'Transform Binary') in the objects (eg Rescaled Cells):
http://d1zymp9ayga15t.cloudfront.net/content/Documentation/cp2.1_2.2manual/MeasureObjectIntensity.html"distance of each cells" is not an precise term, that's why it makes sense to not only have a single distance measurement.
Measuring the 'transformed' image, where each pixel represents the distance to the bloodvessel border, allows you to get:
- average distance of all the pixels to the bloodvessel border (=MeanIntensity)
- minimal distance of any pixel to the bloodvessel border
- maximum distance of any pixel
- median distance of any pixel (=MedianIntensity)
Sorry for I confused the MeasureObjectIntensity
and MeasureImageIntensity
.
And I have got the mean/minIntensity to the edge using the right module. As negative score mean outside the mask, so the Intensity_MaxIntensityEdge_DistanceImage are the actually minimal distance of any pixel of a specific cell to the blood vessel, and vice versa?
Thank you
from imcsegmentationpipeline.
Cool that it finally worked!
"Intensity_MaxIntensityEdge_DistanceImage are the actually minimal distance of any pixel of a specific cell to the blood vessel, and vice versa?"
That sounds correct!"""Beside, I also curious about the cellid problem, would the cellid/number of a specific image change in different cellprofiler mask with identical parameter?""
Hm if I understand you right, your question is, if the 'Image number' are linked to the 'ObjectNumber'.
In CellProfiler each image is given a number before anything is processed. Given you load the same mask/process the data with the same parameters, Object numbers should not change. The Object number should not depend on the 'Image Number' an image is given but really just on the input images.
THANKS A LOT!!!!
from imcsegmentationpipeline.
Related Issues (20)
- Cell segmentation in placental cells. HOT 2
- Error while loading summarizestack HOT 3
- Creating unique .h5 files for Ilastik from ImcSegmentationPipeline Jupyter notebook HOT 2
- Image Stacks Generation - Key Error HOT 19
- Switch use of readimc in pipeline HOT 1
- Error installing conda environment HOT 7
- Pre-processing error HOT 8
- Nd145 not in list error when generating image stacks HOT 5
- Error“Generate image stacks for downstream analyses” HOT 13
- single-cell expression data HOT 1
- Presence of undefined channels during conversion from MCD to ome-TIFF HOT 2
- Numpy float or unsigned integer in TIFF images HOT 3
- Unable to load Ilastik crop pipeline file to CellProfiler HOT 3
- Jupyter-lab did not open Jupyter notebook HOT 5
- TIFF output all black HOT 4
- windows zip file compression type not recognized
- Corrupt MCD file - using .txt instead HOT 4
- Error in 3_measure_mask.cppipe HOT 4
- Error when creating spatial experiment object from IMC segmentation pipeline: 'Could not guess delimiter'. HOT 2
- 1_prepare_ilastik.cppipe pipeline not working HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imcsegmentationpipeline.