How to use Make Projection

Hi!

So my images format is for example:

033_012_02.tif

Where 033 is the xy_square, 012 is the z_field_of_view and 02 the channel.
The modules I used are:
Loadimages
Colortogray
Makeprojection

I succesfully assigned the metadata tags in loadimages.
I succesfully asked to load only 02 channel
I asked to group by xy_square
I turn the images to gray.
I add the makeproyection based on the gray images but there’s no output image coming out.

I also tried adding a saveimages module but it didn’t help.
Do the images have to be in subfolders?

Thanks a lot.

Sorry I just realized this should go have posted on the help forum.

Can you post your pipeline? What you’re describing sounds correct, so I’m not sure why MakeProjection isn’t working. One thing to be aware of is that the final output of MakeProjection will not be shown until the final cycle, because CellProfiler must go through all the images to create the projection.

Hi!

I don’t know if that is part of the issue, but in the max projection window during the process the maxprojection is the same image as the image of each cycle, it does not seem to be projecting.
And no output maxprojection is generated.

Find the pipeline attached.
Thanks alot :smile:
Maxproj.cp (1.87 KB)

We just recently found that MakeProjection doesn’t actually, well, make a projection :wink: This is definitely a bug which we have corrected in our source code, but not yet released.

A possible workaround is to do the following (it’s a bit tricky, so I apologize if my logic is a bit off):

  • Initialize an image of zeros and save it, whether by a pipeline or some other means. Call it X.

  • In another pipeline, use LoadSingleImage/LoadImages to load X and addition to your actual images of interest (call them Y).

  • Use ImageMath to subtract X from Y, setting the pixels below 0 to zero.

  • Use ApplyThreshold to threshold that image above 0 to create a binary mask. These are the pixels in which Y is greater than X.

  • Apply the mask to Y.

  • Invert the mask and apply it to X, to get those pixels in X which are greater than those in Y.

  • Use ImageMath to add the results of the two masking operations together. This should result in an image in which each pixel is the greater of X and Y.

  • Save the result with the same name as X

Each cycle in this pipeline will (should?) compare the new image against this accumulating image of maximum values. The final result should have maximum value of each pixel location of all the images.
-Mark

Hi mbray !

I see the logic behind subtracting all Y(2-n) from Y1 and add the resulting as a mask to obtain the pixels from Y1. Then do the same with Y2,Y3…and finally adding all masked together. But I don’t quite get the need for the allzeroes image.
Still, with 20 images to obtain the projection this way can be cumbersome (around 400 operations)at the imagemath level.

I think the best bet would be to wait till it’s is shortcutted inside the projection module. By the way, my uni has an adapted imagej for the confocal which makes the projecting task pretty painless. It’s just that I pretended to use cellprofiler as an all-in-one solution for everyone not just for my uni. I suppose this will be solved in the next release, and this is beta, so thumbs up :smile:
Just for curiosity, how often do you use to release new versions with bugfixes?

Thanks a lot!

The idea behind the all-zeros image is that template must be initialized somehow, so 0’s starts the pipeline off the right way.

No argument here! :smile:

We don’t have a specific time-deadline, but we do have a system of bug tracking which we prioritize. Once we deem that the critical bugs are taken care of, we plan to do a release.

Regards,
-Mark

Version 9978 has just been released which has a fix for MakeProjection.
-Mark

Hi mbray!

It will sound funny but I still can’t figure out how to make makeprojection work.

Do the images have to be forcerfully in separated folders?

My images are named like:

032_010_01.tif
032_011_01.tif
032_012_01.tif

Which corresponds to the semantic(the regular expression windows shows it’s fine):

^(?P.)_(?P.)_…tif

I ask to group by metadata XYsquare in loadimages

In make proyection I pick the images loaded as …_…_01.tif which are called 488gray.
But the maxprojection only shows the very first image
Am I missing something or is it a bug (using 9978)?

One initial question: Does MakeProjection work if you use it on one folder’s worth of images, i.e., one value of XYsquare so no grouping?
-Mark

Hi mbray!

I tried to simplify it as much as possible.

I putted in the same folder only images that are like:

z000c02.tif
z001c02.tif

z013c02.tif

c02 was used as exact match to load the images
The window shows an appropiate maxaverage on process but it gives an error of “shape missmatch” when it reaches the 8th image. I checked and the 8th image is exactly like the rest so i suppose it is a bug.
The pipeline is as simple as loadimages, makeprojection(MAX), saveimages(lastcycle).
I tried every combination I could imaging in loadimages but it didn’t help.

OK.
I’m very happy 'cos I got it going but at the same time it left me scratching my head.

While what my previous post shows(above) didn’t work, I got my final setup to work :open_mouth: ??

I think it had to be with the structure of the regular expression to load images.

So my images are like:

032_000_01.tif
032_000_02.tif
032_001_01.tif
032_001_01.tif

032_020_01.tif
032_020_02.tif

033_000_01.tif
033_000_02.tif

033_020_01.tif
033_020_02.tif

The images were loaded as exact match 01 for 633; 02 for 488.
The regular expressions that worked were ^(P?.*)
(P?.)_01.tif and ^(P?.)
(P?.*)_02.tif
Images were grouped by xy.
This produced the appropiate images without errors.

It seems that if 01 and 02 were used as metadata in the expression,
for example ^(P?.*)
(P?.*)
(P?.).tif
or were substituted by logical values, for example^(P?.
)(P?.*)…tif
either the load images or makeprojection didn’t quite get it.

Thanks!!!

[quote=“Feel”]The images were loaded as exact match 01 for 633; 02 for 488.
The regular expressions that worked were ^(P?.*)
(P?.)_01.tif and ^(P?.)
(P?.*)_02.tif
Images were grouped by xy.
This produced the appropiate images without errors.[/quote]

I imagine that part of the problem was using “_01” and “_02” for the exact match.

For example, using “_01” would match both of the following (which I assume is not what you want):
032_000**_01**.tif
032**_01**0_02.tif
and there might have been a mismatch in the final internal bookkeeping.

So either you would need to use something like “_01.” (a trailing period for the extension) or the solution you had, i.e., _01 and _02 as metadata in the expression in order to resolve the ambiguity.

Regards,
-Mark

I haven’t checked I’d bet that was the point :smile: