Exemplo n.º 1
0
// ReSharper disable InconsistentNaming
        public void LoadDataset(DatasetDescription datasetDescription)
        {
            UnloadDataset();

            Interop.LoadVolume(datasetDescription.VolumeDescriptions);
            Interop.VisualUpdate();
            Interop.VisualUpdateColorMap();

            var neuralProcessEnumerator = datasetDescription.NeuralProcessDescriptions.GetEnumerator() as IEnumerator <KeyValuePair <int, NeuralProcessDescription> >;

            neuralProcessEnumerator.MoveNext();
            var d3d11CudaTextureEnumerator = Interop.D3D11CudaTextures.Internal.GetEnumerator() as IEnumerator <KeyValuePair <string, ShaderResourceView> >;

            d3d11CudaTextureEnumerator.MoveNext();

            DatasetDescription                    = datasetDescription;
            NeuralProcessEnumerator               = neuralProcessEnumerator;
            D3D11CudaTextureEnumerator            = d3d11CudaTextureEnumerator;
            CurrentNeuralProcess                  = NeuralProcessEnumerator.Current.Value;
            CurrentD3D11CudaTextureIndex          = 0;
            CurrentSegmenterToolMode              = SegmenterToolMode.Adjust;
            CommittedSegmentationEqualsUndoBuffer = true;
            CommittedSegmentationEqualsRedoBuffer = true;
            DatasetLoaded = true;

            D3D11CudaTextureEnumerator.MoveNext();
            CurrentD3D11CudaTextureIndex++;

            D3D11CudaTextureEnumerator.MoveNext();
            CurrentD3D11CudaTextureIndex++;
        }
Exemplo n.º 2
0
        public void LoadDataset(SegmenterImageStackLoadDescription segmenterImageStackLoadDescription)
        {
            var volumeDescriptions = SegmenterImageStackLoader.LoadDataset(segmenterImageStackLoadDescription);

            var neuralProcessDescriptions = new ObservableDictionary <int, NeuralProcessDescription>
            {
                { Constants.DEFAULT_NEURAL_PROCESS.Id, Constants.DEFAULT_NEURAL_PROCESS }
            };

            var datasetDescription = new DatasetDescription
            {
                NeuralProcessDescriptions = neuralProcessDescriptions,
                VolumeDescriptions        = volumeDescriptions
            };

            LoadDataset(datasetDescription);
        }
Exemplo n.º 3
0
        public void LoadDataset(SegmenterImageStackLoadDescription segmenterImageStackLoadDescription, BreadcrumbXmlLoadDescription breadcrumbXmlLoadDescription)
        {
            var volumeDescriptions = SegmenterImageStackLoader.LoadDataset(segmenterImageStackLoadDescription);

            var breadcrumbXmlLoader       = new BreadcrumbXmlLoader();
            var neuralProcessDescriptions = breadcrumbXmlLoader.LoadDataset(breadcrumbXmlLoadDescription);

            neuralProcessDescriptions.Add(Constants.DEFAULT_NEURAL_PROCESS.Id, Constants.DEFAULT_NEURAL_PROCESS);

            var datasetDescription = new DatasetDescription
            {
                NeuralProcessDescriptions = neuralProcessDescriptions,
                VolumeDescriptions        = volumeDescriptions
            };

            LoadDataset(datasetDescription);
        }
// ReSharper restore InconsistentNaming

        public void LoadDataset(DatasetDescription datasetDescription)
        {
            Release.Assert(false);

            //datasetDescription.NeuralProcessDescriptions.Get( "Trail 1" ).BreadcrumbDescriptions.Add(
            //    datasetDescription.NeuralProcessDescriptions.Get( "Trail 2" ).BreadcrumbDescriptions.First() );

            //datasetDescription.NeuralProcessDescriptions.Get( "Trail 1" ).BreadcrumbDescriptions.Add(
            //    datasetDescription.NeuralProcessDescriptions.Get( "Trail 3" ).BreadcrumbDescriptions.First() );

            //datasetDescription.NeuralProcessDescriptions.Get( "Trail 1" ).BreadcrumbDescriptions.Add(
            //    datasetDescription.NeuralProcessDescriptions.Get( "Trail 4" ).BreadcrumbDescriptions.First() );

            //datasetDescription.NeuralProcessDescriptions.Get( "Trail 1" ).BreadcrumbDescriptions.Add(
            //    datasetDescription.NeuralProcessDescriptions.Get( "Trail 5" ).BreadcrumbDescriptions.First() );

            //datasetDescription.NeuralProcessDescriptions.Get( "Trail 1" ).BreadcrumbDescriptions.Add(
            //    datasetDescription.NeuralProcessDescriptions.Get( "Trail 6" ).BreadcrumbDescriptions.First() );

            //datasetDescription.NeuralProcessDescriptions.Get( "Trail 1" ).BreadcrumbDescriptions.Add(
            //    datasetDescription.NeuralProcessDescriptions.Get( "Trail 7" ).BreadcrumbDescriptions.First() );

            //datasetDescription.NeuralProcessDescriptions.Get( "Trail 1" ).Branches =
            //    new List<Edge>
            //            {
            //                new Edge
            //                     {
            //                         P1 = datasetDescription.NeuralProcessDescriptions.Get( "Trail 2" ).BreadcrumbDescriptions.First().Position,
            //                         P2 = datasetDescription.NeuralProcessDescriptions.Get( "Trail 3" ).BreadcrumbDescriptions.First().Position
            //                     },
            //                new Edge
            //                     {
            //                         P1 = datasetDescription.NeuralProcessDescriptions.Get( "Trail 4" ).BreadcrumbDescriptions.First().Position,
            //                         P2 = datasetDescription.NeuralProcessDescriptions.Get( "Trail 5" ).BreadcrumbDescriptions.First().Position
            //                     },
            //                new Edge
            //                     {
            //                         P1 = datasetDescription.NeuralProcessDescriptions.Get( "Trail 6" ).BreadcrumbDescriptions.First().Position,
            //                         P2 = datasetDescription.NeuralProcessDescriptions.Get( "Trail 7" ).BreadcrumbDescriptions.First().Position
            //                     }
            //            };

            //datasetDescription.NeuralProcessDescriptions.Internal =
            //    new ObservableDictionary< string, NeuralProcessDescription >(
            //        ( from neuralProcessDescription in
            //              datasetDescription.NeuralProcessDescriptions.Internal
            //          where neuralProcessDescription.Key == "Trail 1"
            //          select neuralProcessDescription ).ToDictionary( b => b.Key,
            //                                                          b => b.Value ) );



            //Interop.LoadDataset( datasetDescription );

            //VolumeDescription = datasetDescription.VolumeDescriptions.Get( "SourceMap" );

            //var textureDesc3D = new Texture3DDescription
            //                    {
            //                        Width = VolumeDescription.NumVoxelsX,
            //                        Height = VolumeDescription.NumVoxelsY,
            //                        Depth = VolumeDescription.NumVoxelsZ,
            //                        MipLevels = 1,
            //                        Usage = ResourceUsage.Default,
            //                        BindFlags = BindFlags.ShaderResource,
            //                        Format = VolumeDescription.DxgiFormat
            //                    };

            //var shaderResourceViewDesc = new ShaderResourceViewDescription
            //                             {
            //                                 Format = VolumeDescription.DxgiFormat,
            //                                 Dimension = ShaderResourceViewDimension.Texture3D,
            //                                 MipLevels = -1
            //                             };

            //mSourceTexture = new Texture3D( mD3D11Device, textureDesc3D );

            //VolumeDescription.DataStream.Seek( 0, SeekOrigin.Begin );

            //mD3D11DeviceContext.UpdateSubresource(
            //    new DataBox(
            //        VolumeDescription.NumVoxelsX *
            //        VolumeDescription.NumBytesPerVoxel,
            //        VolumeDescription.NumVoxelsY *
            //        VolumeDescription.NumVoxelsX *
            //        VolumeDescription.NumBytesPerVoxel,
            //        VolumeDescription.DataStream ),
            //    mSourceTexture,
            //    0 );

            //SourceTexture = new ShaderResourceView( mD3D11Device, mSourceTexture, shaderResourceViewDesc );

            //AnisotropyFactor = 10f;

            //NormalizedVolumeExtent =
            //    new Vector3( 1f,
            //                 (float)VolumeDescription.NumVoxelsY / VolumeDescription.NumVoxelsX,
            //                 ( VolumeDescription.NumVoxelsZ * AnisotropyFactor ) / VolumeDescription.NumVoxelsX );

            //VolumeIndexToNormalizedVolumeCoordinates =
            //    Matrix.Scaling( NormalizedVolumeExtent.X / VolumeDescription.NumVoxelsX,
            //                    NormalizedVolumeExtent.Y / VolumeDescription.NumVoxelsY,
            //                    NormalizedVolumeExtent.Z / VolumeDescription.NumVoxelsZ );

            //NormalizedVolumeCoordinatesToWorldCoordinates =
            //    Matrix.Reflection( new Plane( Vector3.Zero, Vector3.UnitY ) ) *
            //    Matrix.Translation( 0f, NormalizedVolumeExtent.Y, 0f );

            //NormalizedVolumeCoordinatesToTextureCoordinates =
            //    Matrix.Scaling( 1f / NormalizedVolumeExtent.X,
            //                    1f / NormalizedVolumeExtent.Y,
            //                    1f / NormalizedVolumeExtent.Z );

            //Camera = new Camera( NormalizedVolumeExtent * 4f,
            //                     NormalizedVolumeExtent / 2f,
            //                     new Vector3( 0f, 1f, 0f ),
            //                     Matrix.PerspectiveFovLH( (float)Math.PI / 4, 1f, 0.1f, 100f ) );

            //NeuralProcessDescriptions = datasetDescription.NeuralProcessDescriptions;

            //AugmentedDelaunyEdges = AugmentDelaunyEdges( datasetDescription.NeuralProcessDescriptions, Interop.DelaunyEdges, VolumeIndexToNormalizedVolumeCoordinates );
            //ShortestPathDescriptions = ComputeShortestPaths( datasetDescription.NeuralProcessDescriptions, AugmentedDelaunyEdges, VolumeIndexToNormalizedVolumeCoordinates );
        }