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


TypeScript factory.registerDataSourceFactory函数代码示例

本文整理汇总了TypeScript中neuroglancer/datasource/factory.registerDataSourceFactory函数的典型用法代码示例。如果您正苦于以下问题:TypeScript registerDataSourceFactory函数的具体用法?TypeScript registerDataSourceFactory怎么用?TypeScript registerDataSourceFactory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getMeshSource

}

export function getMeshSource(chunkManager: ChunkManager, url: string, lod: number) {
  const [baseUrls, path] = parseSpecialUrl(url);
  return getShardedMeshSource(chunkManager, {baseUrls, path, lod});
}

let existingVolumes = new Map<string, Promise<MultiscaleVolumeChunkSource>>();
export function getShardedVolume(baseUrls: string[], path: string) {
  let fullKey = stableStringify({'baseUrls': baseUrls, 'path': path});
  let existingResult = existingVolumes.get(fullKey);
  if (existingResult !== undefined) {
    return existingResult;
  }
  let promise = sendHttpRequest(openShardedHttpRequest(baseUrls, path + '/info'), 'json')
                    .then(response => new MultiscaleVolumeChunkSource(baseUrls, path, response));
  existingVolumes.set(fullKey, promise);
  return promise;
}

export function getVolume(url: string) {
  const [baseUrls, path] = parseSpecialUrl(url);
  return getShardedVolume(baseUrls, path);
}

registerDataSourceFactory('precomputed', {
  description: 'Precomputed file-backed data source',
  getVolume: getVolume,
  getMeshSource: getMeshSource,
});
开发者ID:funkey,项目名称:neuroglancer,代码行数:30,代码来源:frontend.ts

示例2: getMeshSource

          mat4.create(), info.qoffset, info.quatern, kOneVec, info.qfac),
      volumeSourceOptions,
    });
    return [[VolumeChunkSource.get(this.chunkManager, spec, {url: this.url})]];
  }

  getMeshSource(): null {
    return null;
  }
}

const VolumeChunkSource = defineParameterizedVolumeChunkSource(VolumeSourceParameters);

function getNiftiVolumeInfo(chunkManager: ChunkManager, url: string, cancellationToken: CancellationToken) {
  return chunkManager.rpc!.promiseInvoke<NiftiVolumeInfo>(
      GET_NIFTI_VOLUME_INFO_RPC_ID, {'chunkManager': chunkManager.addCounterpartRef(), 'url': url},
      cancellationToken);
}

export function getVolume(chunkManager: ChunkManager, url: string) {
  return chunkManager.memoize.getUncounted(
      {type: 'nifti/getVolume', url},
      () => getNiftiVolumeInfo(chunkManager, url, uncancelableToken)
                .then(info => new MultiscaleVolumeChunkSource(chunkManager, url, info)));
}

registerDataSourceFactory('nifti', {
  description: 'Single NIfTI file',
  getVolume: getVolume,
});
开发者ID:janelia-flyem,项目名称:neuroglancer,代码行数:30,代码来源:frontend.ts

示例3: getShardedVolume

};

let existingVolumes = new Map<string, Promise<MultiscaleVolumeChunkSource>>();
export function getShardedVolume(baseUrls: string[], key: string) {
  let cacheKey = stableStringify({'baseUrls': baseUrls, 'key': key});
  let existingResult = existingVolumes.get(key);
  if (existingResult !== undefined) {
    return existingResult;
  }
  let promise =
      sendHttpRequest(openShardedHttpRequest(baseUrls, `/neuroglancer/info/${key}`), 'json')
          .then(response => new MultiscaleVolumeChunkSource(baseUrls, key, response));
  existingVolumes.set(cacheKey, promise);
  return promise;
}

const urlPattern = /^((?:http|https):\/\/[^\/?]+)\/(.*)$/;

export function getVolume(path: string) {
  let match = path.match(urlPattern);
  if (match === null) {
    throw new Error(`Invalid python volume path: ${JSON.stringify(path)}`);
  }
  return getShardedVolume([match[1]], match[2]);
}

registerDataSourceFactory('python', {
  description: 'Python-served volume',
  getVolume: getVolume,
});
开发者ID:funkey,项目名称:neuroglancer,代码行数:30,代码来源:frontend.ts

示例4: getVolume

 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Convenience interface for accessing openconnecto.me server.
 */

import {ChunkManager} from 'neuroglancer/chunk_manager/frontend';
import {registerDataSourceFactory} from 'neuroglancer/datasource/factory';
import {getShardedVolume, tokenAndChannelCompleter} from 'neuroglancer/datasource/ndstore/frontend';
import {LEGACY_URL_PREFIX} from 'neuroglancer/datasource/ndstore/base';

const HOSTNAMES = ['http://openconnecto.me', 'http://www.openconnecto.me'];

export function getVolume(chunkManager: ChunkManager, path: string) {
  return getShardedVolume(chunkManager, HOSTNAMES, path, LEGACY_URL_PREFIX);
}

export function volumeCompleter(url: string, chunkManager: ChunkManager) {
  return tokenAndChannelCompleter(chunkManager, HOSTNAMES, url, LEGACY_URL_PREFIX);
}

registerDataSourceFactory('openconnectome', {
  description: 'NDstore server hosted at openconnecto.me',
  getVolume,
  volumeCompleter,
});
开发者ID:janelia-flyem,项目名称:neuroglancer,代码行数:30,代码来源:frontend.ts

示例5: getPrefixMatchesWithDescriptions

        completions =
            getPrefixMatchesWithDescriptions(channelMatch[2], channelNames, x => x, x => {
              let channelObject = channelsObject[x];
              return `${channelObject['channel_type']} (${channelObject['datatype']})`;

            });
      }
    }
    return {offset: channelMatch[1].length + 1, completions};
  });
}

export function volumeCompleter(url: string): CancellablePromise<CompletionResult> {
  let match = url.match(urlPattern);
  if (match === null) {
    // We don't yet have a full hostname.
    return Promise.reject<CompletionResult>(null);
  }
  let hostnames = [match[1]];
  let path = match[2];
  return cancellableThen(
      tokenAndChannelCompleter(hostnames, path),
      completions => applyCompletionOffset(match[1].length + 1, completions));
}

registerDataSourceFactory('ndstore', {
  description: 'NDstore',
  volumeCompleter: volumeCompleter,
  getVolume: getVolume,
});
开发者ID:j6k4m8,项目名称:neuroglancer,代码行数:30,代码来源:frontend.ts

示例6: getPrefixMatchesWithDescriptions

    if (projectInfo === undefined) {
      return Promise.reject<CompletionResult>(null);
    }
    let completions =
        getPrefixMatchesWithDescriptions(stackMatch[3], projectInfo.stacks, x => x[0], x => {
          return `${x[1].project}`;
        });
    return {offset: stackMatch[1].length + stackMatch[2].length + 2, completions};
  });
}

export function volumeCompleter(
    url: string, chunkManager: ChunkManager): Promise<CompletionResult> {
  let match = url.match(urlPattern);
  if (match === null) {
    // We don't yet have a full hostname.
    return Promise.reject<CompletionResult>(null);
  }
  let hostnames: string[] = match[1].split(',');
  let path = match[2];

  return stackAndProjectCompleter(chunkManager, hostnames, path)
      .then(completions => applyCompletionOffset(match![1].length + 1, completions));
}

registerDataSourceFactory('render', {
  description: 'Render',
  volumeCompleter: volumeCompleter,
  getVolume: getVolume,
});
开发者ID:janelia-flyem,项目名称:neuroglancer,代码行数:30,代码来源:frontend.ts


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