示例#1
0
        public IsIdentifiableHost(
            [NotNull] GlobalOptions globals,
            [NotNull] IsIdentifiableServiceOptions serviceOpts
            )
            : base(globals)
        {
            _consumerOptions = globals.IsIdentifiableOptions;

            string classifierTypename = globals.IsIdentifiableOptions.ClassifierType;
            string dataDirectory      = globals.IsIdentifiableOptions.DataDirectory;

            if (string.IsNullOrWhiteSpace(classifierTypename))
            {
                throw new ArgumentException("No IClassifier has been set in options.  Enter a value for ClassifierType", nameof(globals));
            }
            if (string.IsNullOrWhiteSpace(dataDirectory))
            {
                throw new ArgumentException("A DataDirectory must be set", nameof(globals));
            }

            var objectFactory = new MicroserviceObjectFactory();
            var classifier    = objectFactory.CreateInstance <IClassifier>(classifierTypename, typeof(IClassifier).Assembly, new DirectoryInfo(dataDirectory), serviceOpts);

            if (classifier == null)
            {
                throw new TypeLoadException($"Could not find IClassifier Type { classifierTypename }");
            }

            _producerModel = RabbitMqAdapter.SetupProducer(globals.IsIdentifiableOptions.IsIdentifiableProducerOptions, isBatch: false);

            Consumer = new IsIdentifiableQueueConsumer(_producerModel, globals.FileSystemOptions.FileSystemRoot, globals.FileSystemOptions.ExtractRoot, classifier);
        }
示例#2
0
        private static int OnParse(GlobalOptions globals, object parsedOpts)
        {
            var opts = SmiCliInit.Verify <IsIdentifiableAbstractOptions>(parsedOpts);

            return(opts switch
            {
                IsIdentifiableRelationalDatabaseOptions o => Run(o),
                IsIdentifiableDicomFileOptions o => Run(o),
                IsIdentifiableMongoOptions o => Run(o),
                IsIdentifiableServiceOptions o => Run(o),
                IsIdentifiableFileOptions o => Run(o),
                _ => throw new NotImplementedException($"No case for '{opts.GetType()}'")
            });
示例#3
0
        //public TesseractStanfordDicomFileClassifier(DirectoryInfo dataDirectory) : base(dataDirectory)
        public TesseractStanfordDicomFileClassifier(DirectoryInfo dataDirectory, IsIdentifiableServiceOptions isIdentifiableServiceOptions) : base(dataDirectory)
        {
            var fileOptions = new IsIdentifiableDicomFileOptions();

            //need to pass this so that the runner doesn't get unhappy about there being no reports (even though we clear it below)
            fileOptions.ColumnReport  = true;
            fileOptions.TessDirectory = dataDirectory.FullName;

            fileOptions.IgnoreTextLessThan = isIdentifiableServiceOptions.IgnoreTextLessThan;

            // The Rules directory is always called "IsIdentifiableRules"
            DirectoryInfo[] subDirs = dataDirectory.GetDirectories("IsIdentifiableRules");
            foreach (DirectoryInfo subDir in subDirs)
            {
                fileOptions.RulesDirectory = subDir.FullName;
            }

            _runner = new DicomFileRunner(fileOptions);
        }
示例#4
0
 public RejectAllClassifier(DirectoryInfo dataDirectory, IsIdentifiableServiceOptions _) : base(dataDirectory)
 {
 }