print("\\Clear")
// MIT License
// Copyright (c) 2018 Nicholas Condon n.condon@uq.edu.au
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//IMB Macro Splash screen (Do not remove this acknowledgement)
scripttitle="Canvas Re-sizer Clipping";
version="1.2";
versiondate="20/08/2018";
description="This scipt makes a new blank canvas (increases image size based on user input. "
+"Files to be processed should be in their own directory, processed images will be placed into a subdirectory called Results."
showMessage("Institute for Molecular Biosciences ImageJ Script", ""
+"
ACRF: Cancer Biology Imaging Facility
+"The Institute for Molecular Bioscience
The University of Queensland
+"ACRF: Cancer Biology Imaging Facility<\h4>"
+"ImageJ Script Macro: "+scripttitle+"
"
+"Version: "+version+" ("+versiondate+")"
+"Created by Nicholas Condon
"
+" contact n.condon@uq.edu.au \n "
+" Available for use/modification/sharing under the "+"MIT License<\h4> "
+" <\h3>"
+""+description+"."
+"
"
+" "
+"");
//Log Window Title and Acknowledgement
print("");
print("FIJI Macro: "+scripttitle);
print("Version: "+version+" ("+versiondate+")");
print("ACRF: Cancer Biology Imaging Facility");
print("By Nicholas Condon (2018) n.condon@uq.edu.au")
print("");
getDateAndTime(year, month, week, day, hour, min, sec, msec);
print("Script Run Date: "+day+"/"+(month+1)+"/"+year+" Time: " +hour+":"+min+":"+sec);
print("");
//Directory Warning panel
title = "Select Directory location";
msg = "Use the next window to navigate to your directory of images. (Note a sub-directory called Results will be made within this fodler.)";
waitForUser(title, msg);
//Setting up directory locations etc
run("Clear Results");
path = getDirectory("Choose Source Directory ");
list = getFileList(path);
setBatchMode(true);
//file extension selector and canvas size
width = "4095";
height = "4095";
ext = ".tif";
Dialog.create("Parameters");
Dialog.addMessage("Select the processing steps you would like to run")
Dialog.addMessage(" ");
Dialog.addString("Extension:", ext);
Dialog.addString("Width:", width);
Dialog.addString("Height:", height);
Dialog.show();
ext = Dialog.getString();
width = Dialog.getString();
height = Dialog.getString();
print("Chosen file extension: "+ext);
print("Chosen file width: "+width);
print("Chosen file height: "+height);
start = getTime();
resultsDir = path+"Results_CanvasResized/";
File.makeDirectory(resultsDir);
for (z=0; z