NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 428 - Stack Splitter Problem
Stack Splitter Problem
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: Plugins
unspecified
PC Windows
: P2 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2012-05-11 12:32 CDT by Sebastian Rhode
Modified: 2012-05-14 18:14 CDT
0 users

See Also:

Description Sebastian Rhode 2012-05-11 12:32:35 CDT
Hi,

Since today the plugin Stack Splitter does not seem to work in Fiji any more. I always get the error message ".... image is locked"
When I unlock the image using "Reset..." the message "... is now unlocked is displayed. But still the Stack Splitter does not work.

I downloaded the Stack_Splitter.class (from ImageJ homepage) and copied it to my ImageJ plugin Folder and tried the same. Here is works as expected.

I use Windows7 64bit.

Cheers,

Sebi
Comment 1 Johannes Schindelin 2012-05-12 06:30:09 CDT
Please provide the exact link and preferably a macro to reproduce the issue.
Comment 2 Sebastian Rhode 2012-05-14 09:31:58 CDT
Hi Johannes,

I got the "working stack splitter from here:

http://rsb.info.nih.gov/ij/plugins/splitter.html

and the actual Stack_Splitter.java from:

http://rsb.info.nih.gov/ij/plugins/download/Stack_Splitter.java

I renamed it compiled this one as Stack_Splitter2. And this one works as expected, while the built-in Stack_Splitter shows the described problem (as well after the Fiji update today).

On my PC I can just open a stack and use Stack_Splitter directly and try to split the stack to reproduce the error. Inside my macro it looks like this:


// Author: Sebastian Rhode
// Mail: sebrhode ed googlemail dot com
// Date: 2012-03-14

version_number = 1.3;

// Macro for splitting & stitchinh image files from LA resulting from:
//
// tile protocoll has to setup like this:
// 	Tile
//	    Z-Stack
//		   Multi-Channel
//		
// LA file has the following format: XYZC
// Stitching theme must be: bi-directional
// 01 02 03
// 06 05 04
// 07 08 09

setBatchMode(true);

// open image data file
path = File.openDialog("Select a File");
open(path); // open the file
// open as vitual stack
//run("TIFF Virtual Stack...", "open="+path);

imagedir = File.getParent(path);
imagefilename = File.getName(path);
print("Directory :", imagedir);
print("File Name :", imagefilename);

// check diemsnions of original file
title_orig = getTitle();
selectImage(title_orig);
getDimensions(w,h,ch,sl,fr);
print("X :",w,"Y :",h,"CHANNELS :",ch,"SLICES :",sl,"FRAMES :",fr);
 
// Create a substack directory inside image directory
substackdir = imagedir + File.separator + File.nameWithoutExtension + "_tiles" + File.separator;
File.makeDirectory(substackdir);
if (!File.exists(substackdir))
    exit("Unable to create substack directory");
print("Created Directory : ",substackdir);

// options dialog for stitching
Dialog.create("LA Stitch");
Dialog.addMessage("Version Number: " + toString(version_number,1));
Dialog.addNumber("Grid Size X",5);
Dialog.addNumber("Grid Size Y",5);
Dialog.addNumber("Time Points",1);
Dialog.addNumber("Z-Slices",1);
Dialog.addNumber("Color Channels",2);
Dialog.addNumber("Tile Overlap %",10);
Dialog.show();
gridx = Dialog.getNumber();
gridy = Dialog.getNumber();
numt = Dialog.getNumber();
numz = Dialog.getNumber();
numch = Dialog.getNumber();
overlap = Dialog.getNumber();

// calculate number of z-stacks = number of tiles
numstacks = gridx * gridy;
print("Total Number of images: ",numstacks*numz*numch);

// determine file identifier
fid = "i";
if (numstacks > 9) fid="ii";
if (numstacks > 99) fid="iii";
if (numstacks > 999) fid="iiii";
print(fid);

// unlock image - just be on the safe side to make the original Stack_Splitter work, but no sucess so far ...
run("Reset...", "reset=[Locked Image]");

// split complete file into single tiles --> z-stacks
run("Stack Splitter", "number="+numstacks); // usually used by Fiji --> does not work since 2012_05_11
//run("Stack Splitter2", "number="+numstacks); //use this on e instead

// close original window
wait(1000);
selectImage(title_orig);
close();

// save splitted z-stacks and adapt dimensions
for (i=1; i<=numstacks; i++) {
	
	//print("Current Stack:",i);
	if (i > 999){
		fidstr = i; // i has 4 digits
		current_title = "slice"+i+"_"+title_orig;
		//current_title = "stk_"+i+"_"+title_orig;
		//print("Current FID String:",fidstr);
	}
	else if (i > 99){
		fidstr = "0"+i; // i has 3 digits
		current_title = "slice0"+i+"_"+title_orig;
		//current_title = "stk_0"+i+"_"+title_orig;
		//print("Current FID String:",fidstr);
	}
	else if (i > 9){
		fidstr = "00"+i; // i has 2 digits
		//current_title = "stk_00"+i+"_"+title_orig;
		current_title = "slice00"+i+"_"+title_orig;
		//print("Current FID String:",fidstr);
	}
	else if (i > 0){
		fidstr = "000"+i; // i has 1 digit
		current_title = "slice000"+i+"_"+title_orig;
		//current_title = "stk_000"+i+"_"+title_orig;
		//print("Current FID String:",fidstr);
	}
	
	selectImage(current_title); // select current image
	//run("Stack to Hyperstack...", "order=xyczt(default) channels="+numch+" slices="+numz+" frames="+numt+" display=Grayscale");	
	save(substackdir+"tile_"+fidstr+".tif");
	print("Current Tile Saved: ","tile_"+fidstr+".tif");
	selectImage(current_title);
	close();

}

// run the stitching
run("Grid/Collection stitching", "type=[Grid: snake by rows] order=[Right & Down                ] grid_size_x="+gridx+" grid_size_y="+gridy+" tile_overlap="+overlap+" first_file_index_i=1 directory="+substackdir+" file_names=tile_{iiii}.tif output_textfile_name=TileConfiguration.txt fusion_method=[Linear Blending] regression_threshold=0.30 max/avg_displacement_threshold=2.50 absolute_displacement_threshold=3.50 compute_overlap subpixel_accuracy computation_parameters=[Save memory (but be slower)] image_output=[Fuse and display]");

// save resulting image
stitched_filename = replace(imagefilename, ".tif", "_stitched.tif");
print("Stiched Filename : ",stitched_filename);
savename = imagedir + File.separator + stitched_filename;
saveAs("Tiff", savename);
setBatchMode(false);
Comment 3 Johannes Schindelin 2012-05-14 18:14:59 CDT
That additional information was crucial. I updated the Stack Splitter in the Stack Manipulation package, committed, pushed and uploaded.