Example #1
0
  void colorIsosurface() {
    if (params.isSquared && volumeData != null) volumeData.filterData(true, Float.NaN);
    /*    if (params.isContoured && marchingSquares == null) {
          //    if (params.isContoured && !(jvxlDataIs2dContour || params.thePlane != null)) {
          Logger.error("Isosurface error: Cannot contour this type of data.");
          return;
        }
    */
    if (meshDataServer != null) {
      meshDataServer.fillMeshData(meshData, MeshData.MODE_GET_VERTICES, null);
    }

    jvxlData.saveVertexCount = 0;
    if (params.isContoured && marchingSquares != null) {
      initializeMapping();
      params.setMapRanges(this, false);
      marchingSquares.setMinMax(params.valueMappedToRed, params.valueMappedToBlue);
      jvxlData.saveVertexCount = marchingSquares.contourVertexCount;
      contourVertexCount =
          marchingSquares.generateContourData(
              jvxlDataIs2dContour, (params.isSquared ? 1e-8f : 1e-4f));
      jvxlData.contourValuesUsed = marchingSquares.getContourValues();
      minMax = marchingSquares.getMinMax();
      if (meshDataServer != null) meshDataServer.notifySurfaceGenerationCompleted();
      finalizeMapping();
    }

    applyColorScale();
    jvxlData.nContours = (params.contourFromZero ? params.nContours : -1 - params.nContours);
    jvxlData.jvxlFileMessage =
        "mapped: min = " + params.valueMappedToRed + "; max = " + params.valueMappedToBlue;
  }