Automating Partial stacks in Zerene Stacker

A forum to ask questions, post setups, and generally discuss anything having to do with photomacrography and photomicroscopy.

Moderators: rjlittlefield, ChrisR, Chris S., Pau

elf
Posts: 1416
Joined: Sun Nov 18, 2007 12:10 pm

Automating Partial stacks in Zerene Stacker

Post by elf »

The batch processing utility in Zerene Stacker can really make it easy to edit deep stacks, but creating the batch file can be a lot work. See the Zerene Stacker tutorials at http://www.zerenesystems.com/cms/stacke ... howtouseit for more information on batch processing.

I've written a little C# command line application to generate the xml files that are consumed by Zerene Stacker's batch utility. It can create batch files that will do partial (incremental) stacks as well as stacks suitable for movies. See http://www.photomacrography.net/forum/v ... php?t=9320 for an example of the movie mode)

There is a readme.txt file in the zip file, that has detailed information on how to run the application. Download the zip file to your computer, unzip to a folder, and execute the program (specifying the necessary parameters).

The zip file is located at http://myplace.frontier.com/~edward.fre ... S_0712.zip Running the application may require .NET 3.5 to be installed. I have only used this on Windows 7, so can't guarantee that it will work on any other OS.

Enjoy

Chris S.
Site Admin
Posts: 4042
Joined: Sun Apr 05, 2009 9:55 pm
Location: Ohio, USA

Post by Chris S. »

Wow, Ed, thanks! Excellent.

I could use a film like that to show people what it is we gain from focus stacking. Your film does this, but I'd like to have one that matches one of my subjects, taken at a higher magnification. Now, to put it on the list of things to get around to. . . .

Thanks for sharing!

--Chris

seta666
Posts: 1071
Joined: Fri Mar 19, 2010 8:50 am
Location: Castellon, Spain

Post by seta666 »

Thank you Elf; this is a wonderfull utility, specially whern many partial stacks are needed
Regards

johan
Posts: 1005
Joined: Tue Sep 06, 2011 7:39 am
Contact:

Post by johan »

This looks really useful! I just did my first manual substack stack and it makes quite the difference... so big thank you Elf!

Just checking if I'm doing this right

Unzip etc
use DOS window, fill params 1 by 1, start by giving it a name?

(I'm a little unclear on these please, what do they mean?)

Code: Select all

-SelectedStackOverlap
   Amount of overlap in Selected Stack
-AllImageStackType
   0: Don't create an All Image stack
   1: PMAX only
   2: DMAP only
   3: PMAX and DMAP
   4: Align All
then call this xml from inside zerene
close zerene, reopen, stack substacks using dmap

That's it, condensed?

Thank you very much

update: I have discovered exe.config, makes things much easier. But still a bit unclear what some of these params are.
My extreme-macro.co.uk site, a learning site. Your comments and input there would be gratefully appreciated.

johan
Posts: 1005
Joined: Tue Sep 06, 2011 7:39 am
Contact:

Post by johan »

ok, specific question.

I've filled in exe.config, but I cannot for the life of me get the xml file generated. Can someone give me noddy foolproof instructions please what I should be doing - @"ZereneVS in dos in the right directory returns me a message "Number of command line parameters = 0" but doesn't generate an xml out of the info I put into exe.config.

Help?!

Thank you
My extreme-macro.co.uk site, a learning site. Your comments and input there would be gratefully appreciated.

elf
Posts: 1416
Joined: Sun Nov 18, 2007 12:10 pm

Post by elf »

The commandline shoud be something like this:
ZereneVS.exe -SourceImageFolder <path to images> -SourceImageFileMask jpg -OutputType 1 -SelectedStackImageCount 7 -SelectedStackType 4 -SelectedStackOverlap 2 -AllImageStackType 0

The above assumes you're using jpegs and want PMax stacks. Individual stacks will contain seven images with the first two images and last two images also contained in the previous and next stack.

There is a little bug in ZereneVS.exe. It sets the OutputImagesDesignatedFolder value to <source image folder>\Automation\zOut but creates a folder named <source image folder>\Automation\zsOut. Renaming the folder to zOut cures the problem.

descall
Posts: 178
Joined: Sat Oct 01, 2011 3:12 pm
Location: United Kingdom

Post by descall »

Many thanks for sharing this; exceptionally useful! :D

I have a quick query. With 62 input images I used the following commands to create partial stacks ('slabs'):
-SelectedStackImageCount 10
-SelectedStackOverlap 4

After the batch completed I end up with 10 partial stacks in the zOut subfolder. How was the number of partial stacks determined by the script and is it possible to identify which images went into each partial stack?

Thanks for your help (and thanks again for a very useful piece of work!).

Best wishes,
Des

rjlittlefield
Site Admin
Posts: 23563
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

Zerene's batch scripts are human-readable XML. You can open them with any text editor, and the tag names should be suggestive enough to figure out what's going on. In this case, look for SelectedInputIndices followed by a list of SelectedInputIndex values. The index values start numbering at 0 within the list of input files.
With 62 input images I used the following commands to create partial stacks ('slabs'):
-SelectedStackImageCount 10
-SelectedStackOverlap 4
From the parameters you've listed, I imagine that the stacks will consist of selected indices as follows:

0-9 (first slab: 10 images)
6-15 (second slab: 10 images, 4 shared with first slab)
12-21 (third slab: 10 images, 4 shared with second slab)
18-27 etc.
24-33
32-41
38-47
44-53
50-59
56-61 (tenth slab: all the remaining images, sharing 4 images with ninth slab)

If you'd like to have the slab outputs named to include bits of the file names, then consider changing the output image naming template as described at http://zerenesystems.com/cms/stacker/do ... tput_names.

--Rik

elf
Posts: 1416
Joined: Sun Nov 18, 2007 12:10 pm

Post by elf »

Rik has it exactly right :)

You can set the output naming template by adding the parameter to the ZereneVS command line.

Example:
-OutputImageNamingTemplate "{method} skip={FSF},EstimationRadius={ER},ContrastThresholdPct={CTPCT}"

Note: When a Zerene Stacker parameter has a '.', just delete the '.' to create the ZereneVS parameter.

descall
Posts: 178
Joined: Sat Oct 01, 2011 3:12 pm
Location: United Kingdom

Post by descall »

Wonderful, many thanks indeed :D

Rollin
Posts: 33
Joined: Tue Jan 11, 2011 1:13 pm
Location: Belgium
Contact:

Post by Rollin »

Zerene's batch scripts are human-readable XML.
Rik, Humans come in many types. A sheet of Rachmaninov music is also human readable (dots go up= higher pitch: very easy).

I'm struggling all day now with this, and I'm still nowhere. I keep on trying, but for people who hear the word xml for the first time this way of working is extremely complicated.

Just venting some frustration ;-))

Kind regards,

Rollin

edit1: I'm getting somewhere, I have a XML file now that Zerene seems to accept, but nothing happens. This was the command line

ZereneVS.exe
-SourceImageFolder C:\substack\substackfolder\images -ProjectsDesignatedFolder C:\substack\project -OutputImagesDesignatedFolder C:\substack\substackfolder\output -SourceImageFileMask jpg
-OutputType 1
-SelectedStackImageCount 10
-SelectedStackType 4
-SelectedStackOverlap 2
-AllImageStackType 0
-BatchXmlName rollinbatch1.xml

78 images, substacks of 10 images with an overlap of 2.

edit2: For other simple minds like myself: you should run this batch with the images imported in Zerene. Batch>load batch script>rollinbatch1.xml (in this case). Now it seems to work more or less, nothing is opened nor saved automatically. But it worked.

elf
Posts: 1416
Joined: Sun Nov 18, 2007 12:10 pm

Post by elf »

I think the more you use the batch file capabilities, whether you use ZereneVS or the Zerene Stacker batch dialog, the more you'll understand what you need to set for a particular set of images. Zerene Stacker is a pretty complex program and it's amazing Rik was able to expose most of it in the batch xml file format. The first batch file I created was over 11,000 lines long and would have been rather tedious to do manually :) See http://www.photomacrography.net/forum/v ... ight=movie.

The following additions to your commandline will create PMax and DMap stacks of all images plus PMax slabs and loads the source images:

ZereneVS.exe
-SourceImageFolder C:\substack\substackfolder\images
-ProjectsDesignatedFolder C:\substack\project
-OutputImagesDesignatedFolder C:\substack\substackfolder\output
-SourceImageFileMask jpg
-OutputType 1
-SelectedStackImageCount 10
-SelectedStackType 4
-SelectedStackOverlap 2
-BatchXmlName rollinbatch1.xml
-AllImageStackType 3
-Source C:\substack\substackfolder\images
-OutputImageDispositionCode 3
-OutputImageNamingTemplate "{method} skip={FSF},EstimationRadius={ER},ContrastThresholdPct={CTPCT}"


p.s. The DMap stack will require user input unless you add more parameters to control those settings.

Rollin
Posts: 33
Joined: Tue Jan 11, 2011 1:13 pm
Location: Belgium
Contact:

Post by Rollin »

:smt038

Thank you very much for your help. You know, in our language Elf means Fairy?

I've been thinking why it is so hard to understand for me, but there is a double language barrier. First, I have to cope with English jargon before I can begin with the structure of the XML. Imagine all these words and phrases would be in French or Dutch. That's why lots of things that are easy to understand for Americans are difficult for the rest of us.

I hope Rik will find the time to add this function to Zerene. On the other hand, there must be some challenge left I guess ;-)

Thanks again!

Rollin

rjlittlefield
Site Admin
Posts: 23563
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

Rollin wrote:
Zerene's batch scripts are human-readable XML.
Rik, Humans come in many types. A sheet of Rachmaninov music is also human readable (dots go up= higher pitch: very easy).
Well said. I apologize for the difficulty.

--Rik

Rollin
Posts: 33
Joined: Tue Jan 11, 2011 1:13 pm
Location: Belgium
Contact:

Post by Rollin »

No need to apologize of course. I guess it was not you who invented XML in the first place nor that nearly all IT jargon is in English.

Well, I can blame the Dutch for that, something to do with the second Anglo-Dutch war and New Amsterdam becoming New York.

I'm slabbing away now, no worries

Rollin

Post Reply Previous topicNext topic