Creating file names using measurements and adding leading 0's

When I extract metadata from my images, the time counting starts at 0, so I have Metadata_T = 0, 1, 2, 3, etc. I want to save my output images with a naming convention that includes the time (so, image_1) but would like that to start at 1 rather than 0. I know I can create a new measurement that is time_adjusted = Metadata_T+1, but I can’t figure out how to include this new measurement in a name for an output file. Additionally, I’d like the numbering for the output files to actually have leading 0’s, so to be image_001, image_002, image_003,…,image_100 and I can’t find a way so far to do this either. Is this possible to do in CellProfiler? Right now I am doing it post-hoc in matlab but that is taking a long time so I would prefer to just name them what I want the first time in CP rather than renaming after.

Leading 0s has been an issue in CellProfiler for a while, we’re hoping to address it soon, it just didn’t quite make the cut for the 4.0 release.

WRT changing the index by 1, the only option I can think of (outside of pre-or-post-hoc renaming, which as you’ve pointed out has its own disadvantages) is to use the Metadata module’s CSV upload function to give it an extra piece of Metadata called “CorrectedTimepoint” (or something like that), where you then say if CellProfiler’s extracted timepoint = 0, that CorrectedTimepoint = 001 (here is an example from a different use case). It is also formally possible that you’d be able to add leading 0s in that way; the GH issue I linked above had to do with LoadData CSVs, rather than Metadata ones, I DOUBT they’re internally handled the same way, but probably worth a few minutes to find out.

Thanks Beth, I’ll give that a try and see if it works!