Beispiel #1
0
        public void SetCanvas(NMImage image)
        {
            try
            {
                DcmObject = image.DicomObj;

                //Calculate scale factor for cell dimensions
                int imageWidth = 0, imageHeight = 0;
                ScaleLayout(ref imageWidth, ref imageHeight);

                //Add columns with scaled widths
                for (int i = 0; i < Columns; i++)
                {
                    ColumnDefinition colDef = new ColumnDefinition();
                    GridLength width = new GridLength(imageWidth * ScaledWidth);
                    colDef.Width = width;
                    CanvasGrid.ColumnDefinitions.Add(colDef);
                }

                //Add rows with scaled heights
                for (int i = 0; i < Rows; i++)
                {
                    RowDefinition rowDef = new RowDefinition();
                    GridLength height = new GridLength(imageHeight * ScaledHeight);
                    rowDef.Height = height;
                    CanvasGrid.RowDefinitions.Add(rowDef);
                }

                Console.Out.WriteLine(image.FilePath);
                //var owPixel = image.DicomObj.FindFirst(TagHelper.PIXEL_DATA) as OtherWordString;
                //byte[] img = (owPixel.Data_).ToArray();
                DcmImage = new ImageMatrix(image.FilePath);
                Console.Out.WriteLine("LET ME GO!!");
            }
            catch(Exception e)
            {
                MessageBox.Show("Error setting up canvas: " + e.Message + e.StackTrace);
            }
        }
Beispiel #2
0
 public NMImageDA(NMImage parent)
 {
     ParentImage = parent;
 }
Beispiel #3
0
        ///////////////////////////////////////////////////////////////////////////////
        #endregion

        #region Save Image Methods
        /******************************************************************************
         * Save Image Use Case 
         *****************************************************************************/
        public bool SaveAsNewImage(Canvas canvas, IExam exam, SaveAttributes saveAtts)
        {
            byte[] image = SnapshotCanvas(canvas, saveAtts);
            DICOMObject dicomObj = CreateDICOMObject(image, saveAtts, canvas, exam.Images[0].DicomObj);
            if (dicomObj != null && WriteFile(dicomObj, saveAtts))
            {
                NMImage nmImage = new NMImage(saveAtts, Exam.ExamID, Exam.TechInitials);
                if (nmImage.UpdateDB(saveAtts))
                    return true;

                System.Windows.MessageBox.Show("Not Working");
            }
            return false;
        }