Skip to content
Snippets Groups Projects
Commit 14345375 authored by Vojtech Moravec's avatar Vojtech Moravec
Browse files

Generalized the custom function.

parent fa5b5ed0
Branches
No related tags found
No related merge requests found
......@@ -22,12 +22,29 @@ public class MeasurePlaneErrorFunction extends CustomFunctionBase {
@Override
public boolean run() {
final int channel = 0;
boolean result = true;
result &= runPlaneDifferenceForAllBits(0, "vq3x3", "plane_codebook", "D:\\biology\\tiff_data\\quantized");
result &= runPlaneDifferenceForAllBits(0, "vq9x1", "plane_codebook", "D:\\biology\\tiff_data\\quantized");
result &= runPlaneDifferenceForAllBits(1, "vq3x3", "plane_codebook", "D:\\biology\\tiff_data\\quantized");
result &= runPlaneDifferenceForAllBits(1, "vq9x1", "plane_codebook", "D:\\biology\\tiff_data\\quantized");
return result;
}
public boolean runPlaneDifferenceForAllBits(final int channel,
final String method,
final String type,
final String folder) {
System.out.println(
String.format("runPlaneDifferenceForAllBits\n\tChannel: %d\n\tMethod: %s\n\tType: %s",
channel, method, folder));
// final int channel = 0;
assert (channel == 0 || channel == 1);
final String comp_file = channel == 0 ? COMP_FILE_ch0 : COMP_FILE_ch1;
final String method = "sq";
final String type = "plane_codebook";
final String folder = "D:\\biology\\tiff_data\\quantized";
// final String method = "sq";
// final String type = "plane_codebook";
// final String folder = "D:\\biology\\tiff_data\\quantized";
if (reportPlaneDifference(
String.format("%s\\%s\\fused_tp_10_ch_%d_16bit_%s_cb256.raw", folder, type, channel, method),
......@@ -78,13 +95,6 @@ public class MeasurePlaneErrorFunction extends CustomFunctionBase {
return false;
}
// if (reportPlaneDifference(
// "D:\\biology\\tiff_data\\quantized\\plane_codebook\\fused_tp_10_ch_1_16bit_sq_cb4.raw",
// "D:\\biology\\tiff_data\\quantized\\plane_codebook\\plane_diff_ch1\\sq_cb4_plane_log.data",
// comp_file)) {
// return false;
// }
return true;
}
......@@ -94,8 +104,6 @@ public class MeasurePlaneErrorFunction extends CustomFunctionBase {
final int workerCount = 8;
final V3i dims = new V3i(1041, 996, 946);
final int planePixelCount = dims.getX() * dims.getY();
System.out.println(options.report());
System.out.println("Run custom function.");
// ImageU16 compressedPlane = null;
// ImageU16 originalPlane = null;
// ImageU16 differencePlane = null;
......@@ -142,28 +150,6 @@ public class MeasurePlaneErrorFunction extends CustomFunctionBase {
e.printStackTrace();
}
// for (int planeIndex = 0; planeIndex < dims.getZ(); planeIndex++) {
// try {
// originalPlane = RawDataIO.loadImageU16(referenceFile, dims, planeIndex);
// compressedPlane = RawDataIO.loadImageU16(compressedFile, dims, planeIndex);
// } catch (IOException e) {
// e.printStackTrace();
// return true;
// }
//
//
// final int[] diffData = Utils.getDifference(originalPlane.getData(), compressedPlane.getData());
// Utils.applyAbsFunction(diffData);
//
//
// final double absDiffSum = Arrays.stream(diffData).mapToDouble(v -> v).sum();
// final double meanPixelError = absDiffSum / (double) planePixelCount;
//
// planeErrors[planeIndex] = new PlaneError(planeIndex, absDiffSum, meanPixelError);
// // System.out.println("Finished plane: " + planeIndex);
// }
try (FileOutputStream fos = new FileOutputStream(reportFile, false);
OutputStreamWriter writer = new OutputStreamWriter(fos)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment