コード例 #1
0
 private gdcm.FilenamesType GetFilteredFiles(string path, Func <float, string, float> progressCallback)
 {
     gdcm.FilenamesType unsortedFiles = GetUnsortedFilenameList(path);
     progressCallback(0.01f, "Aquired file list.");
     gdcm.Scanner       scanner       = PrepareFileScanner();
     gdcm.FilenamesType filteredFiles = ScanFiles(scanner, unsortedFiles);
     progressCallback(0.05f, "Filtered files.");
     return(filteredFiles);
 }
コード例 #2
0
    /// <summary>
    /// Scan the given directory with the given scanner returning the only the files that
    /// have the tags on the given scanner.
    /// </summary>
    /// <param name="scanner">The scanner with the tags</param>
    /// <param name="directory">The directory to be scanned</param>
    /// <returns>The file list without the files that don't have the tags.</returns>
    gdcm.FilenamesType ScanFiles(gdcm.Scanner scanner, gdcm.FilenamesType directory)
    {
        bool b = scanner.Scan(directory);

        if (!b)
        {
            throw new FileScanException(directory.First());
        }
        return(scanner.GetKeys());
    }
コード例 #3
0
 /// <summary>
 /// Creates a file scanner that reads the tags that I use to sort the files.
 /// </summary>
 /// <returns>The file scanner.</returns>
 private gdcm.Scanner PrepareFileScanner()
 {
     gdcm.Scanner s0 = new gdcm.Scanner();
     s0.AddTag(Tags.StudyInstanceUID);
     s0.AddTag(Tags.SeriesInstanceUID);
     s0.AddTag(Tags.PatientName);
     s0.AddTag(Tags.DirectionCosines);
     s0.AddTag(Tags.ImagePosition);
     return(s0);
 }