001/**
002 * Copyright (C) 2014  Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/
003 *
004 * This file is part of Dicoogle/dicoogle.
005 *
006 * Dicoogle/dicoogle is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * Dicoogle/dicoogle is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with Dicoogle.  If not, see <http://www.gnu.org/licenses/>.
018 */
019package pt.ua.dicoogle.rGUI.server;
020
021import java.io.File;
022import java.io.IOException;
023
024import org.dcm4che2.io.DicomInputStream;
025
026
027import pt.ua.dicoogle.plugins.PluginController;
028
029/**
030 *
031 * @author carloscosta
032 */
033@Deprecated
034public class DicoogleScan {
035    private File path = null;
036
037    public DicoogleScan(File path){
038        this.path = path;
039    }
040
041    public DicoogleScan(String path){
042        this(new File(path));
043    }
044    public void scan(boolean resume){
045        scan(path, resume);
046    }
047
048    private void scan(File path, boolean resume){
049        if (path == null)
050                return;
051
052            
053        
054            //long time = System.nanoTime();
055
056            // O Método FileIndexer.index já a indexação recursiva de files DICOM
057            
058            System.out.println("Calling Index");
059            PluginController.getInstance().index(path.toURI());
060            
061
062            //core.indexQueue(path.getAbsolutePath(), resume);
063
064            //System.out.println("\n***Directory Index Time (miliseg)***"
065            //                 + "\nStart Time: " + time + "\nEnd Time:" + System.nanoTime()
066            //                 + "\nDelta Time: " + ((System.nanoTime() - time)/1000000L));
067
068    }
069
070    public static boolean isDicom(File file) throws IOException
071    {
072        boolean result = false;
073        DicomInputStream dis = new DicomInputStream(file);
074        if (dis.getTransferSyntax() != null)
075            result = true;
076        return result;
077    }
078
079}