コード例 #1
0
    public static int Main(string[] args)
    {
        string filename    = args[0];
        string outfilename = args[1];

        using (var sfcts = FileChangeTransferSyntax.New())
        {
            FileChangeTransferSyntax fcts = sfcts.__ref__();
            //SimpleSubjectWatcher watcher = new SimpleSubjectWatcher(fcts, "FileChangeTransferSyntax");
            gdcm.TransferSyntax ts = new TransferSyntax(TransferSyntax.TSType.JPEGLSNearLossless);
            fcts.SetTransferSyntax(ts);
            ImageCodec  ic     = fcts.GetCodec();
            JPEGLSCodec jpegls = JPEGLSCodec.Cast(ic);
            jpegls.SetLossless(false);
            jpegls.SetLossyError(2);

            fcts.SetInputFileName(filename);
            fcts.SetOutputFileName(outfilename);
            if (!fcts.Change())
            {
                return(1);
            }
        }

        return(0);
    }
コード例 #2
0
    public static int Main(string[] args)
    {
        string filename    = args[0];
        string outfilename = args[1];

        using (var sfcts = FileChangeTransferSyntax.New())
        {
            FileChangeTransferSyntax fcts = sfcts.__ref__();
            //SimpleSubjectWatcher watcher = new SimpleSubjectWatcher(fcts, "FileChangeTransferSyntax");
            gdcm.TransferSyntax ts = new TransferSyntax(TransferSyntax.TSType.JPEG2000);
            fcts.SetTransferSyntax(ts);
            ImageCodec    ic       = fcts.GetCodec();
            JPEG2000Codec jpeg2000 = JPEG2000Codec.Cast(ic);
            jpeg2000.SetReversible(false);
            jpeg2000.SetQuality(0, 55);

            fcts.SetInputFileName(filename);
            fcts.SetOutputFileName(outfilename);
            if (!fcts.Change())
            {
                return(1);
            }
        }

        return(0);
    }
コード例 #3
0
ファイル: FCTS_RLE.cs プロジェクト: milhcbt/GDCM
    public static int Main(string[] args)
    {
        string filename    = args[0];
        string outfilename = args[1];

        using (var sfcts = FileChangeTransferSyntax.New())
        {
            FileChangeTransferSyntax fcts = sfcts.__ref__();
            //SimpleSubjectWatcher watcher = new SimpleSubjectWatcher(fcts, "FileChangeTransferSyntax");
            gdcm.TransferSyntax ts = new TransferSyntax(TransferSyntax.TSType.RLELossless);
            fcts.SetTransferSyntax(ts);
            ImageCodec ic  = fcts.GetCodec();
            RLECodec   rle = RLECodec.Cast(ic);
            // need to call at least one member func to check not NULL:
            long val = rle.GetBufferLength();

            fcts.SetInputFileName(filename);
            fcts.SetOutputFileName(outfilename);
            if (!fcts.Change())
            {
                return(1);
            }
        }

        return(0);
    }
コード例 #4
0
    static private void CompressIntoJPEG(string rawdicom, string jpegdicom)
    {
        using (var sfcts = FileChangeTransferSyntax.New())
        {
            // Need to retrieve the actual C++ reference, to pass to
            // SimpleSubjectWatcher:
            FileChangeTransferSyntax fcts    = sfcts.__ref__();
            SimpleSubjectWatcher     watcher = new SimpleSubjectWatcher(fcts, "FileChangeTransferSyntax");
            gdcm.TransferSyntax      ts      = new TransferSyntax(TransferSyntax.TSType.JPEGBaselineProcess1);
            fcts.SetTransferSyntax(ts);
            ImageCodec ic   = fcts.GetCodec();
            JPEGCodec  jpeg = JPEGCodec.Cast(ic);
            jpeg.SetLossless(false);
            jpeg.SetQuality(50); // poor quality !

            fcts.SetInputFileName(rawdicom);
            fcts.SetOutputFileName(jpegdicom);
            fcts.Change();
        }
    }