当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript vec3.create方法代码示例

本文整理汇总了TypeScript中neuroglancer/util/geom.vec3.create方法的典型用法代码示例。如果您正苦于以下问题:TypeScript vec3.create方法的具体用法?TypeScript vec3.create怎么用?TypeScript vec3.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在neuroglancer/util/geom.vec3的用法示例。


在下文中一共展示了vec3.create方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

  constructor(options: VolumeChunkSpecificationOptions) {
    let {
      lowerVoxelBound = kZeroVec,
      upperVoxelBound,
      chunkDataSize,
      voxelSize,
      transform,
      baseVoxelOffset = kZeroVec
    } = options;
    let {
      lowerClipBound = vec3.multiply(vec3.create(), voxelSize, lowerVoxelBound),
      upperClipBound = vec3.multiply(vec3.create(), voxelSize, upperVoxelBound)
    } = options;
    const chunkSize = vec3.multiply(vec3.create(), chunkDataSize, voxelSize);
    let lowerChunkBound = vec3.create();
    let upperChunkBound = vec3.create();
    for (let i = 0; i < 3; ++i) {
      lowerChunkBound[i] = Math.floor(lowerVoxelBound[i] / chunkDataSize[i]);
      upperChunkBound[i] = Math.floor((upperVoxelBound[i] - 1) / chunkDataSize[i] + 1);
    }
    super({voxelSize, transform, lowerChunkBound, upperChunkBound, chunkSize});
    this.baseVoxelOffset = baseVoxelOffset;
    this.lowerClipBound = lowerClipBound;
    this.upperClipBound = upperClipBound;
    this.lowerVoxelBound = lowerVoxelBound;
    this.upperVoxelBound = upperVoxelBound;
    this.chunkDataSize = chunkDataSize;

    let dataType = this.dataType = options.dataType;
    let numChannels = this.numChannels = options.numChannels;

    this.chunkBytes = prod3(chunkDataSize) * DATA_TYPE_BYTES[dataType] * numChannels;

    this.compressedSegmentationBlockSize = options.compressedSegmentationBlockSize;
  }
开发者ID:google,项目名称:neuroglancer,代码行数:35,代码来源:base.ts

示例2: constructor

 constructor (response: any) {
   if (typeof response !== 'object' || Array.isArray(response)) {
     throw new Error('Failed to parse volume metadata.');
   }
   this.resolution = parseFiniteVec(vec3.create(), response['resolution']);
   this.voxelOffset = parseIntVec(vec3.create(), response['voxel_offset']);
   this.size = parseIntVec(vec3.create(), response['size']);
   this.chunkSizes = parseArray(response['chunk_sizes'], x => parseFiniteVec(vec3.create(), x));
   if (this.chunkSizes.length === 0) {
     throw new Error('No chunk sizes specified.');
   }
   let encodingStr = response['encoding'];
   let encoding = serverChunkEncodings.get(encodingStr);
   if (encoding === undefined) {
     throw new Error(`Invalid chunk encoding: ${JSON.stringify(encodingStr)}`);
   }
   this.encoding = encoding;
   if (encoding === VolumeChunkEncoding.COMPRESSED_SEGMENTATION) {
     this.compressedSegmentationBlockSize = parseIntVec(vec3.create(), response['compressed_segmentation_block_size']);
   }
   this.key = response['key'];
   if (typeof this.key !== 'string') {
     throw new Error('No key specified.');
   }
 }
开发者ID:j6k4m8,项目名称:neuroglancer,代码行数:25,代码来源:frontend.ts

示例3: parseStackInfo

function parseStackInfo(obj: any): StackInfo|undefined {
  verifyObject(obj);

  let state = verifyObjectProperty(obj, 'state', verifyString);

  let channels: string[] = [];
  let lowerVoxelBound: vec3 = vec3.create();
  let upperVoxelBound: vec3 = vec3.create();

  if (VALID_STACK_STATES.has(state)) {
    let stackStatsObj = verifyObjectProperty(obj, 'stats', verifyObject);

    lowerVoxelBound = parseLowerVoxelBounds(stackStatsObj);
    upperVoxelBound = parseUpperVoxelBounds(stackStatsObj);

    if (stackStatsObj.hasOwnProperty('channelNames')) {
      channels = parseChannelNames(stackStatsObj);
    }
  } else if (PARTIAL_STACK_STATES.has(state)) {
    // Stacks in LOADING state will not have a 'stats' object.
    // Values will be populated from command arguments in MultiscaleVolumeChunkSource()
  } else {
    return undefined;
  }

  let voxelResolution: vec3 = verifyObjectProperty(obj, 'currentVersion', parseStackVersionInfo);

  let project: string = verifyObjectProperty(obj, 'stackId', parseStackProject);

  return {lowerVoxelBound, upperVoxelBound, voxelResolution, project, channels};
}
开发者ID:google,项目名称:neuroglancer,代码行数:31,代码来源:frontend.ts

示例4: getStaticAnnotations

 getStaticAnnotations() {
   const {topLevelMetadata, baseScaleIndex} = this;
   const annotationSet = new AnnotationSource(mat4.fromScaling(
       mat4.create(),
       vec3.multiply(
           vec3.create(), topLevelMetadata.pixelResolution,
           topLevelMetadata.scales[baseScaleIndex])));
   annotationSet.readonly = true;
   annotationSet.add(makeDataBoundsBoundingBox(vec3.create(), this.scales[baseScaleIndex]!.size));
   return annotationSet;
 }
开发者ID:google,项目名称:neuroglancer,代码行数:11,代码来源:frontend.ts

示例5:

 return this.scales.map(scaleInfo => {
   return VolumeChunkSpecification
       .getDefaults({
         voxelSize: scaleInfo.resolution,
         dataType: this.dataType,
         numChannels: this.numChannels,
         transform: mat4.fromTranslation(
             mat4.create(),
             vec3.multiply(vec3.create(), scaleInfo.resolution, scaleInfo.voxelOffset)),
         upperVoxelBound: scaleInfo.size,
         volumeType: this.volumeType,
         chunkDataSizes: scaleInfo.chunkSizes,
         baseVoxelOffset: scaleInfo.voxelOffset,
         compressedSegmentationBlockSize: scaleInfo.compressedSegmentationBlockSize,
         volumeSourceOptions,
       })
       .map(spec => this.chunkManager.getChunkSource(PrecomputedVolumeChunkSource, {
         spec,
         parameters: {
           'baseUrls': this.baseUrls,
           'path': `${this.path}/${scaleInfo.key}`,
           'encoding': scaleInfo.encoding
         }
       }));
 });
开发者ID:google,项目名称:neuroglancer,代码行数:25,代码来源:frontend.ts

示例6: getSources

  getSources(vectorGraphicsSourceOptions: VectorGraphicsSourceOptions) {
    const voxelSize = this.stackInfo.voxelResolution;
    const chunkSize = vec3.subtract(
        vec3.create(), this.stackInfo.upperVoxelBound, this.stackInfo.lowerVoxelBound);
    vec3.multiply(chunkSize, chunkSize, voxelSize);
    chunkSize[2] = voxelSize[2];

    const spec = VectorGraphicsChunkSpecification.make({
      voxelSize,
      chunkSize,
      lowerChunkBound: vec3.fromValues(0, 0, this.stackInfo.lowerVoxelBound[2]),
      upperChunkBound: vec3.fromValues(1, 1, this.stackInfo.upperVoxelBound[2]),
      vectorGraphicsSourceOptions
    });
    const source = this.chunkManager.getChunkSource(PointMatchSource, {
      spec,
      parameters: {
        'baseUrls': this.baseUrls,
        'owner': this.ownerInfo.owner,
        'project': this.stackInfo.project,
        'stack': this.stack,
        'encoding': 'points',
        'matchCollection': this.matchCollection,
        'zoffset': this.zoffset
      }
    });

    return [[source]];
  }
开发者ID:google,项目名称:neuroglancer,代码行数:29,代码来源:frontend.ts

示例7: withDefaultCompression

 /**
  * Returns a VolumeChunkSpecification with default compression specified if suitable for the
  * volumeType.
  */
 static withDefaultCompression(options: VolumeChunkSpecificationDefaultCompressionOptions&
                               VolumeChunkSpecificationOptions&
                               VolumeChunkSpecificationVolumeSourceOptions) {
   let {
     compressedSegmentationBlockSize,
     dataType,
     voxelSize,
     transform,
     lowerVoxelBound,
     upperVoxelBound
   } = options;
   transform = getCombinedTransform(transform, options.volumeSourceOptions);
   if (compressedSegmentationBlockSize === undefined &&
       options.volumeType === VolumeType.SEGMENTATION &&
       (dataType === DataType.UINT32 || dataType === DataType.UINT64)) {
     compressedSegmentationBlockSize = getNearIsotropicBlockSize({
       voxelSize,
       transform,
       lowerVoxelBound,
       upperVoxelBound,
       maxVoxelsPerChunkLog2: 9,
       maxBlockSize: vec3.min(
           vec3.create(), options.chunkDataSize,
           options.maxCompressedSegmentationBlockSize || kInfinityVec),
     });
   }
   return new VolumeChunkSpecification(
       Object.assign({}, options, {compressedSegmentationBlockSize, transform}));
 }
开发者ID:google,项目名称:neuroglancer,代码行数:33,代码来源:base.ts

示例8: stableStringify

 return this.scales.map(scaleInfo => {
   return Array
       .from(VolumeChunkSpecification.getDefaults({
         voxelSize: scaleInfo.resolution,
         dataType: this.dataType,
         numChannels: this.numChannels,
         lowerVoxelBound: scaleInfo.voxelOffset,
         upperVoxelBound: vec3.add(vec3.create(), scaleInfo.voxelOffset, scaleInfo.size),
         volumeType: this.volumeType,
         chunkDataSizes: scaleInfo.chunkSizes,
         compressedSegmentationBlockSize: scaleInfo.compressedSegmentationBlockSize
       }))
       .map(spec => {
         let path = `${this.path}/${scaleInfo.key}`;
         let cacheKey = stableStringify({
           'spec': spec,
           'baseUrls': this.baseUrls,
           'path': path,
           'encoding': scaleInfo.encoding
         });
         return chunkManager.getChunkSource(
             VolumeChunkSource, cacheKey,
             () => new VolumeChunkSource(
                 chunkManager, spec, this.baseUrls, path, scaleInfo.encoding));
       });
 });
开发者ID:j6k4m8,项目名称:neuroglancer,代码行数:26,代码来源:frontend.ts

示例9: getSources

  getSources(volumeSourceOptions: VolumeSourceOptions) {
    let sources: VolumeChunkSource[][] = [];

    let numLevels = this.numLevels; 
    if (numLevels === undefined) {
      numLevels = computeStackHierarchy(this.stackInfo, this.dims[0]);
    }

    for (let level = 0; level < numLevels; level++) {
      let voxelSize = vec3.clone(this.stackInfo.voxelResolution);
      let chunkDataSize = vec3.fromValues(1, 1, 1);
      // tiles are NxMx1
      for (let i = 0; i < 2; ++i) {
        voxelSize[i] = voxelSize[i] * Math.pow(2, level);
        chunkDataSize[i] = this.dims[i];
      }

      let lowerVoxelBound = vec3.create(), upperVoxelBound = vec3.create();

      for (let i = 0; i < 3; i++) {
        lowerVoxelBound[i] = Math.floor(
            this.stackInfo.lowerVoxelBound[i] * (this.stackInfo.voxelResolution[i] / voxelSize[i]));
        upperVoxelBound[i] = Math.ceil(
            this.stackInfo.upperVoxelBound[i] * (this.stackInfo.voxelResolution[i] / voxelSize[i]));
      }

      let spec = VolumeChunkSpecification.make({
        voxelSize,
        chunkDataSize,
        numChannels: this.numChannels,
        dataType: this.dataType, lowerVoxelBound, upperVoxelBound, volumeSourceOptions,
      });

      let source = TileChunkSource.get(this.chunkManager, spec, {
        'baseUrls': this.baseUrls,
        'owner': this.ownerInfo.owner,
        'project': this.stackInfo.project,
        'stack': this.stack,
        'encoding': this.encoding,
        'level': level,
        'dims': `${this.dims[0]}_${this.dims[1]}`,
      });

      sources.push([source]);
    }
    return sources;
  }
开发者ID:janelia-flyem,项目名称:neuroglancer,代码行数:47,代码来源:frontend.ts

示例10: constructor

 constructor(gl: GL, public chunkDataSize: Vec3, public subchunkSize: Vec3, dataLength: number) {
   super();
   compute1dTextureLayout(this, gl, /*texelsPerElement=*/1, dataLength);
   let subchunkGridSize = this.subchunkGridSize = vec3.create();
   for (let i = 0; i < 3; ++i) {
     subchunkGridSize[i] = Math.ceil(chunkDataSize[i] / subchunkSize[i]);
   }
 }
开发者ID:funkey,项目名称:neuroglancer,代码行数:8,代码来源:chunk_format.ts


注:本文中的neuroglancer/util/geom.vec3.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。