public ReconstructionProcessor(BlockingCollection <PermProjectionInfo> projectionInfos,
                                PermStorageFolderStructure folderStructure, IRTKWrapper rtkWrapper)
 {
     _projectionInfos = projectionInfos;
     _rtkWrapper      = rtkWrapper;
     _targetPath      = folderStructure.MhaPath + "ReconstructedImage.mha";
 }
Beispiel #2
0
        public ISubfolderMonitorListener CreateFileMonitorListener(PermStorageFolderStructure structure, BlockingCollection <TempProjectionInfo> queue)
        {
            var factory = new ProjectionInfoInfoFactory();
            var projectionController = new ProjectionEventHandler(factory, structure, queue);

            return(new SubfolderMonitorListener(projectionController));
        }
 public ProjectionCopier(IProjectionInfoFactory projectionInfoFactory, IFileUtil fileUtil, BlockingCollection<TempProjectionInfo> inQueue,
     BlockingCollection<PermProjectionInfo> outQueue, PermStorageFolderStructure folderStructure)
 {
     _projectionInfoFactory = projectionInfoFactory;
     _fileUtil = fileUtil;
     _inQueue = inQueue;
     _outQueue = outQueue;
     _folderStructure = folderStructure;
 }
Beispiel #4
0
 public ProjectionEventHandler(IProjectionInfoFactory projectionInfoFactory,
                               PermStorageFolderStructure relatedFolderStructure, BlockingCollection <TempProjectionInfo> queue)
 {
     _projectionInfoFactory = projectionInfoFactory;
     _lock             = new object();
     _currentFileIndex = 0;
     _folderStructure  = relatedFolderStructure;
     _queue            = queue;
 }
Beispiel #5
0
        public PermProjectionInfo CreatePermProjectionInfo(PermStorageFolderStructure folderStructure,
                                                           TempProjectionInfo tempProjectionInfo)
        {
            ValidateInputs(folderStructure.XimPath, tempProjectionInfo.Id);

            var fileName       = "proj" + tempProjectionInfo.Id + ".xim";
            var fullTargetPath = Path.Combine(folderStructure.XimPath, fileName);

            return(new PermProjectionInfo {
                FileName = fileName, FilePath = fullTargetPath, Id = tempProjectionInfo.Id
            });
        }
        public void CreatePermProjectionInfo_ValidCases_InfoIsCorrect(string target, int index)
        {
            //Act:
            var tempInfo = _uut.CreateTempProjectionInfo("Random source", index);

            var folderStructure = new PermStorageFolderStructure("base", target, "mhaPath", "ctPath");

            var permInfo = _uut.CreatePermProjectionInfo(folderStructure, tempInfo);

            //Assert:
            Assert.That(permInfo.Id, Is.EqualTo(index));
            Assert.That(permInfo.FileName, Is.EqualTo("proj" + index + ".xim"));
            Assert.That(permInfo.FilePath, Is.EqualTo(target + "\\" + "proj" + index + ".xim"));
        }
Beispiel #7
0
 public Task CreateFoldersAsync(PermStorageFolderStructure structure)
 {
     if (structure == null)
     {
         throw new ArgumentNullException(nameof(structure));
     }
     return(Task.Run(async() =>
     {
         Logger.Info("Creates target folders.");
         await _fileUtil.CreateFolderAsync(structure.BasePath);
         TaskWatcher.AddTask(_fileUtil.CreateFolderAsync(structure.XimPath));
         TaskWatcher.AddTask(_fileUtil.CreateFolderAsync(structure.MhaPath));
         TaskWatcher.AddTask(_fileUtil.CreateFolderAsync(structure.CtPath));
     }));
 }
        public void CreateFoldersAsync_CreatesFolderStructure_FileUtilIsCalled()
        {
            //Arrange:
            var basePath = "base";
            var ximPath  = "xim";
            var mhaPath  = "mha";
            var ctPath   = "ct";
            PermStorageFolderStructure structure = new PermStorageFolderStructure(basePath, ximPath, mhaPath, ctPath);

            //Act:
            var task = _uut.CreateFoldersAsync(structure);

            Task.WaitAll(task);
            _fakeFileUtil.Received().CreateFolderAsync(basePath);
            _fakeFileUtil.Received().CreateFolderAsync(ximPath);
            _fakeFileUtil.Received().CreateFolderAsync(mhaPath);
            _fakeFileUtil.Received().CreateFolderAsync(ctPath);
        }
Beispiel #9
0
        private IReconstructionProcessor StartPipeline(IFileMonitor fileMonitor, PermStorageFolderStructure folderStructure)
        {
            BlockingCollection <TempProjectionInfo> queue1 = new BlockingCollection <TempProjectionInfo>();
            BlockingCollection <PermProjectionInfo> queue2 = new BlockingCollection <PermProjectionInfo>();

            var eventHandler = _projectionPipelineFactory.CreateFileMonitorListener(folderStructure, queue1);

            fileMonitor.Created  += eventHandler.OnNewFileDetected;
            fileMonitor.Finished += eventHandler.OnMonitorFinished;

            var copier = _projectionPipelineFactory.CreateProjectionCopier(queue1, queue2, folderStructure);

            TaskWatcher.AddTask(copier.StartCopyingFiles());

            var reconstructionProcessor = _projectionPipelineFactory.CreateReconstructionProcessor(queue2, folderStructure);

            TaskWatcher.AddTask(reconstructionProcessor.StartConsumingProjections());
            return(reconstructionProcessor);
        }
Beispiel #10
0
 public IProjectionCopier CreateProjectionCopier(BlockingCollection <TempProjectionInfo> queueIn,
                                                 BlockingCollection <PermProjectionInfo> queueOut, PermStorageFolderStructure folderStructure)
 {
     return(new ProjectionCopier(new ProjectionInfoInfoFactory(), new FileUtil(), queueIn, queueOut, folderStructure));
 }
Beispiel #11
0
 public IReconstructionProcessor CreateReconstructionProcessor(BlockingCollection <PermProjectionInfo> queue, PermStorageFolderStructure folderStructure)
 {
     return(new ReconstructionProcessor(queue, folderStructure, new RTKWrapper()));
 }
 public PipelineStartedArgs(PermStorageFolderStructure permStorageFolderStructure,
                            IReconstructionProcessor processor)
 {
     PermStorageFolderStructure = permStorageFolderStructure;
     Processor = processor;
 }