Beispiel #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;
  }
Beispiel #2
0
  private void generateSurfaceData() {
    edgeData = "";
    if (vertexDataOnly) {
      try {
        readSurfaceData(false);
      } catch (Exception e) {
        e.printStackTrace();
        Logger.error("Exception in SurfaceReader::readSurfaceData: " + e.getMessage());
      }
      return;
    }
    contourVertexCount = 0;
    int contourType = -1;
    marchingSquares = null;

    if (params.thePlane != null || params.isContoured) {
      marchingSquares =
          new MarchingSquares(
              this,
              volumeData,
              params.thePlane,
              params.contoursDiscrete,
              params.nContours,
              params.thisContour,
              params.contourFromZero);
      contourType = marchingSquares.getContourType();
      marchingSquares.setMinMax(params.valueMappedToRed, params.valueMappedToBlue);
    }
    params.contourType = contourType;
    params.isXLowToHigh = isXLowToHigh;
    marchingCubes = new MarchingCubes(this, volumeData, params, jvxlVoxelBitSet);
    String data = marchingCubes.getEdgeData();
    if (params.thePlane == null) edgeData = data;
    jvxlData.setSurfaceInfoFromBitSet(marchingCubes.getBsVoxels(), params.thePlane);
    jvxlData.jvxlExcluded = params.bsExcluded;
    if (isJvxl) edgeData = jvxlEdgeDataRead;
    postProcessVertices();
  }