Exemple #1
0
        protected void LoadProbeClicked(object sender, EventArgs e)
        {
            Gtk.FileChooserDialog fcd = new Gtk.FileChooserDialog("Open File", null, Gtk.FileChooserAction.Open);
            fcd.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
            fcd.AddButton(Gtk.Stock.Open, Gtk.ResponseType.Ok);
            fcd.DefaultResponse = Gtk.ResponseType.Ok;
            fcd.SelectMultiple  = false;

            Gtk.FileFilter filter = new FileFilter
            {
                Name = "NIRS probe"
            };
            filter.AddMimeType("XML");
            filter.AddMimeType("Matlab");
            filter.AddPattern("*.SD");
            filter.AddPattern("*.xml");
            fcd.Filter = filter;

            fcd.SetCurrentFolder(MainClass.win.settings.PROBEDIR);

            Gtk.ResponseType response = (Gtk.ResponseType)fcd.Run();
            if (response == Gtk.ResponseType.Ok)
            {
                probe = nirs.io.LoadProbe(fcd.Filename);
                Sdgdraw(sender, e);
            }
            probefilename = fcd.Filename;
            fcd.Destroy();
        }
Exemple #2
0
                    public void Initialize(nirs.core.Probe probe)
                    {
                        // Sets the mapping between data and the probe.


                        //wavelengths = new int[] { 735, 850 };
                        int[] DetIdx = new int[] { 1, 5, 1, 5, 1, 5, 1, 5, 2, 6, 2, 6, 2, 6, 2, 6, 3, 7, 3, 7, 3, 7, 3, 7, 4, 8, 4, 8, 4, 8, 4, 8 };
                        int[] SrcIdx = new int[] { 1, 3, 1, 3, 2, 4, 2, 4, 1, 3, 1, 3, 2, 4, 2, 4, 1, 3, 1, 3, 2, 4, 2, 4, 1, 3, 1, 3, 2, 4, 2, 4 };
                        int[] TypIdx = new int[] { 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2 };

                        _nmeas = probe.numChannels;

                        MLorder = new List <int>();
                        for (int i = 0; i < probe.numChannels; i++)
                        {
                            int found = -1;
                            for (int j = 0; j < DetIdx.Length; j++)
                            {
                                if (probe.ChannelMap[i].sourceindex == SrcIdx[j] - 1 &
                                    probe.ChannelMap[i].detectorindex == DetIdx[j] - 1 &
                                    probe.ChannelMap[i].wavelength == wavelengths[TypIdx[j] - 1])
                                {
                                    found = j;
                                    break;
                                }
                            }
                            if (found > -1)
                            {
                                MLorder.Add(found);
                            }
                        }
                    }
Exemple #3
0
            public void Intialize(nirs.core.Probe probe)
            {
                switch (devicetype)
                {
                case 0:
                    ((NIRSDAQ.Instrument.Devices.Simulator)device).Initialize(probe);

                    break;

                case 1:
                    ((NIRSDAQ.Instrument.Devices.TechEn.BTnirs)device).Initialize(probe);
                    break;
                }
            }
Exemple #4
0
        protected void StudyChanged(object sender, EventArgs e)
        {
            string rootfolder = MainClass.win.settings.DATADIR;

            string[] investigators = Directory.GetDirectories(rootfolder);
            int      i             = combobox_investigators.Active;


            if (i > -1 & i < investigators.Length)
            {
                string[] studies = Directory.GetDirectories(investigators[i]);
                int      j       = combobox_studies.Active;

                if (j > -1 & j < studies.Length)
                {
                    string[] subjids = Directory.GetDirectories(studies[j]);

                    Gtk.ListStore ClearList = new Gtk.ListStore(typeof(string));
                    comboboxentry_subjID.Model = ClearList;

                    if (subjids.Length > 0)
                    {
                        //this.investigatorlist.Clear ();
                        foreach (string s in subjids)
                        {
                            string[] s2 = s.Split(System.IO.Path.DirectorySeparatorChar);
                            comboboxentry_subjID.AppendText(s2[s2.Length - 1]);
                        }
                    }
                    comboboxentry_subjID.AppendText("New Subject");
                    comboboxentry_subjID.Active = subjids.Length;

                    string probefile = System.IO.Path.Combine(studies[j], @"Probe.xml");
                    if (System.IO.File.Exists(probefile))
                    {
                        probe         = nirs.io.LoadProbe(probefile);
                        probefilename = probefile;
                        Sdgdraw(sender, e);
                    }
                    else
                    {
                        probe = new nirs.core.Probe();
                    }
                }
            }
            ShowAll();
        }
Exemple #5
0
                public void Initialize(nirs.core.Probe probe)
                {
                    _nmeas    = probe.numChannels;
                    dataqueue = new Queue[_nmeas];
                    for (int i = 0; i < _nmeas; i++)
                    {
                        dataqueue[i] = new Queue();
                    }

                    auxqueue = new Queue[_naux];
                    for (int i = 0; i < _naux; i++)
                    {
                        auxqueue[i] = new Queue();
                    }

                    Probe = probe;
                }
Exemple #6
0
        public RegisterSubject() :
            base(Gtk.WindowType.Toplevel)
        {
            this.Build();
            device_previous = 0;
            this.drawingarea1.ExposeEvent += Sdgdraw;
            probe = new nirs.core.Probe();

            //this.previewSDG.ExposeEvent += sdgdraw;
            //  DeleteEvent += delegate { this.Dispose(); };

            // Populate the investigator/study/subjid folders
            string rootfolder = MainClass.win.settings.DATADIR;

            string[]      investigators = Directory.GetDirectories(rootfolder);
            Gtk.ListStore ClearList     = new Gtk.ListStore(typeof(string));

            combobox_investigators.Model = ClearList;
            foreach (string s in investigators)
            {
                string[] s2 = s.Split(System.IO.Path.DirectorySeparatorChar);
                combobox_investigators.AppendText(s2[s2.Length - 1]);
            }

            combobox_investigators.Active = 0;

            demo = new nirs.Dictionary[MainClass.devices.Length];
            for (int i = 0; i < MainClass.devices.Length; i++)
            {
                demo[i] = new nirs.Dictionary();
                demo[i].set("SubjID", comboboxentry_subjID.ActiveText);
                demo[i].set("Investigator", combobox_investigators.ActiveText);
                demo[i].set("Study", combobox_studies.ActiveText);
                demo[i].set("Gender", demo_gender.ActiveText);
                demo[i].set("Group", demo_group.Text);
                demo[i].set("Age", demo_age.Text);
                demo[i].set("Instrument", MainClass.win.settings.SYSTEM);
                demo[i].set("head_circumference", demo_headsize.Text);
                demo[i].set("Technician", demo_tecnician.Text);
                demo[i].set("comments", demo_comments.Buffer.Text);
            }



            Gtk.ListStore ClearList2 = new Gtk.ListStore(typeof(string));
            this.combobox_hyperscanning.Model = ClearList2;
            for (int i = 0; i < MainClass.devices.Length; i++)
            {
                this.combobox_hyperscanning.AppendText(MainClass.devices[i].devicename);
            }
            this.combobox_hyperscanning.Active = 0;

            if (MainClass.devices.Length == 1)
            {
                this.combobox_hyperscanning.Destroy();
                this.label_hypersacan.Destroy();
                this.combobox_hyperscanning.Destroy();
            }


            ShowAll();
        }