use of loci.common.Location in project bioformats by openmicroscopy.
the class ImageFaker method fakeScreen.
public boolean fakeScreen(String[] args) {
DebugTools.enableLogging("INFO");
boolean validArgs = parseArgs(args);
if (!validArgs || targetDirectoryPath == null) {
printUsage();
return false;
}
// make sure that we don't end up with just a ".fake" directory
if (new Location(targetDirectoryPath).exists()) {
Location p = new Location(targetDirectoryPath, "screen.fake");
int index = 1;
while (p.exists()) {
p = new Location(targetDirectoryPath, "screen" + index + ".fake");
index++;
}
targetDirectoryPath = p.getAbsolutePath();
}
Location directoryRoot;
if (!FormatHandler.checkSuffix(targetDirectoryPath, ResourceNamer.FAKE_EXT)) {
directoryRoot = new Location(targetDirectoryPath + ResourceNamer.DOT + ResourceNamer.FAKE_EXT);
} else {
directoryRoot = new Location(targetDirectoryPath);
}
FakeImage fake = new FakeImage(directoryRoot);
fake.generateScreen(plates, plateAcquisitions, rows, columns, fields);
return true;
}
use of loci.common.Location in project bioformats by openmicroscopy.
the class FormatReaderTest method writeConfigFile.
@Test(groups = { "config" })
public void writeConfigFile() {
setupReader();
if (!initFile(false))
return;
String file = reader.getCurrentFile();
try {
String parent = new Location(file).getParent();
String configDir = configTree.getConfigDirectory();
String rootDir = configTree.getRootDirectory();
if (configDir != null) {
parent = parent.replaceAll(rootDir, configDir);
File parentDir = new File(parent);
if (!parentDir.exists()) {
parentDir.mkdirs();
}
}
File f = new File(parent, ".bioformats");
LOGGER.info("Generating configuration: {}", f);
Configuration newConfig = new Configuration(reader, f.getAbsolutePath());
newConfig.saveToFile();
reader.close();
} catch (Throwable t) {
LOGGER.info("", t);
assert false;
}
}
use of loci.common.Location in project bioformats by openmicroscopy.
the class TestTools method getExternalSymlinkConfigFile.
/**
* Retrieve an external symlinked configuration file given a root directory
* and a test configuration.
* @deprecated No replacement.
*/
@Deprecated
public static String getExternalSymlinkConfigFile(String root, final ConfigurationTree config) {
// Look for a configuration file under the configuration directory
try {
String canonicalRoot = new Location(root).getCanonicalPath();
if (!root.equals(canonicalRoot)) {
String configCanonicalRoot = config.relocateToConfig(canonicalRoot);
Location configFile = new Location(configCanonicalRoot, baseConfigName);
if (configFile.exists()) {
return configFile.getAbsolutePath();
}
}
} catch (IOException e) {
}
;
return null;
}
use of loci.common.Location in project bioformats by openmicroscopy.
the class Configuration method putTableName.
private void putTableName(IniTable table, IFormatReader reader, String suffix) {
Location file = new Location(reader.getCurrentFile());
table.put(IniTable.HEADER_KEY, file.getName() + suffix);
}
use of loci.common.Location in project bioformats by openmicroscopy.
the class Configuration method setSeries.
public void setSeries(int series) {
Location file = new Location(dataFile);
currentTable = ini.getTable(file.getName() + SERIES + series);
}
Aggregations