Exemplo n.º 1
0
 def open_mri_se(self):
     self.stop_all()
     self.stacked_widget.setCurrentIndex(1)
     self.mriSeWidget.set_freq(parameters.get_freq())
     self.mriSeWidget.freqValue.setValue(parameters.get_freq())
     # self.mriSeWidget.atValue.setValue(parameters.get_at())
     self.setWindowTitle('MRI tabletop - SE GUI')
Exemplo n.º 2
0
 def open_mri_fid(self):
     self.stop_all()
     self.stacked_widget.setCurrentIndex(0)
     # update frequency to server
     self.mriFidWidget.set_freq(parameters.get_freq())
     self.mriFidWidget.freqValue.setValue(
         parameters.get_freq())  # maybe put this in lower funcs
     self.setWindowTitle('MRI tabletop - FID GUI')
Exemplo n.º 3
0
    def init_var(self):
        self.centeringFlag = False
        self.attenuationFlag = False

        self.acqTimeout = self.timeoutValue.value() / 1000
        self.acqCount = 0

        self.centerFreq = 0
        self.centerPeak = 0

        self.at_results = []

        self.freqEstimation.setValue(parameters.get_freq())
        self.freqSpan.setValue(0.60)
        self.freqSteps.setValue(6)
        self.atStart.setValue(16)
        self.atStop.setValue(24)
        self.atSteps.setValue(8)
Exemplo n.º 4
0
    def analytics(self):

        self.peak_value = round(np.max(self.fft_mag), 2)
        self.peak.setText(str(self.peak_value))

        # Calculate fwhm
        max_value = np.max(self.fft_mag)
        self.max_index = np.argmax(self.fft_mag)
        bound_high = self.max_index
        bound_low = self.max_index

        while 1:
            if self.fft_mag[bound_low] < 0.5 * max_value:
                break
            bound_low = bound_low - 1
        while 1:
            if self.fft_mag[bound_high] < 0.5 * max_value:
                break
            bound_high = bound_high + 1

        self.fwhm_value = bound_high - bound_low
        freq_span = abs(np.min(self.freqaxis)) + abs(np.max(self.freqaxis))
        self.fwhm.setText(
            str(round(self.fwhm_value * freq_span / self.data_idx)) + " Hz")

        # Calculate the SNR value inside a peak window
        peak_window = self.fwhm_value * 5
        self.noise_bound_low = int(self.max_index - peak_window / 2)
        self.noise_bound_high = int(self.max_index + peak_window / 2)
        # Join noise outside peak window, calculate std. dev. and snr = peak/std.dev.
        noise = np.concatenate((self.fft_mag[0:self.noise_bound_low],
                                self.fft_mag[self.noise_bound_high:]))
        self.snr_value = round(self.peak_value / np.std(noise), 2)
        # print("snr_value: ", snr_value)
        self.snr.setText(str(self.snr_value))

        # Calculate center frequency
        self.center_freq = parameters.get_freq() + (
            (self.max_index - 5000 / 2) * 250000 / 5000) / 1.0e6
        # 250000 sampling rate, 5000 number of samples for FFT
        self.centerFreq.setText(str(round(self.center_freq, 5)))

        print("\tData analysed.")
Exemplo n.º 5
0
 def open_mri_sd(self):
     self.stop_all()
     self.stacked_widget.setCurrentIndex(7)
     self.mriRtWidget.set_freq(parameters.get_freq())
     self.mriRtWidget.freqValue.setValue(parameters.get_freq())
     self.setWindowTitle('MRI tabletop - Sequence Design GUI')
Exemplo n.º 6
0
 def open_mri_rt(self):
     self.stop_all()
     self.stacked_widget.setCurrentIndex(6)
     self.mriRtWidget.set_freq(parameters.get_freq())
     self.mriRtWidget.freqValue.setValue(parameters.get_freq())
     self.setWindowTitle('MRI tabletop - Real-time Update GUI')
Exemplo n.º 7
0
 def open_mri_3dimag(self):
     self.stop_all()
     self.stacked_widget.setCurrentIndex(5)
     self.mri3DImagWidget.set_freq(parameters.get_freq())
     self.mri3DImagWidget.freqValue.setValue(parameters.get_freq())
     self.setWindowTitle('MRI tabletop - 3D Image GUI')
Exemplo n.º 8
0
 def open_mri_proj(self):
     self.stop_all()
     self.stacked_widget.setCurrentIndex(3)
     self.mriProjWidget.set_freq(parameters.get_freq())
     self.mriProjWidget.freqValue.setValue(parameters.get_freq())
     self.setWindowTitle('MRI tabletop - 1D Projection GUI')
Exemplo n.º 9
0
 def open_mri_sig(self):
     self.stop_all()
     self.stacked_widget.setCurrentIndex(2)
     self.mriSigWidget.set_freq(parameters.get_freq())
     self.mriSigWidget.freqValue.setValue(parameters.get_freq())
     self.setWindowTitle('MRI tabletop - Signals GUI')
Exemplo n.º 10
0
    def display_data(self):
        # Clear the plots: bottom-time domain, top-frequency domain
        self.axes_bottom.clear()
        self.axes_bottom.grid()
        self.axes_top.clear()
        self.axes_top.grid()

        # Get magnitude, real and imaginary part of data
        data = self.data
        mag = np.abs(data)
        real = np.real(data)
        imag = np.imag(data)

        # Plot the bottom (time domain): display time signal from 0~21ms [0~5250]
        time = 20
        data_idx = int(time * 250)
        mag_t = mag[0:data_idx]
        real_t = real[0:data_idx]
        imag_t = imag[0:data_idx]
        time_axis = np.linspace(0, time, data_idx)
        self.curve_bottom = self.axes_bottom.plot(time_axis, mag_t)  # blue
        self.curve_bottom = self.axes_bottom.plot(time_axis, real_t)  # red
        self.curve_bottom = self.axes_bottom.plot(time_axis, imag_t)  # green
        self.axes_bottom.set_xlabel('time, ms')

        # Plot the top (frequency domain): use signal from 0.5~20.5ms: first 0.5ms junk
        # update: the junk is already taken care of by the sequence timing
        dclip = data[0:data_idx]
        freqaxis = np.linspace(-125000, 125000, data_idx)  # 5000 points ~ 20ms
        fft_mag = abs(np.fft.fftshift(np.fft.fft(np.fft.fftshift(dclip))))
        if not self.freqCheckBox.isChecked():  # non zoomed
            self.curve_top = self.axes_top.plot(
                freqaxis[int(data_idx / 2 - data_idx / 10):int(data_idx / 2 +
                                                               data_idx / 10)],
                fft_mag[int(data_idx / 2 - data_idx / 10):int(data_idx / 2 +
                                                              data_idx / 10)])
        else:  # zoomed
            self.curve_top = self.axes_top.plot(
                freqaxis[int(data_idx / 2 -
                             data_idx / 100):int(data_idx / 2 +
                                                 data_idx / 100)],
                fft_mag[int(data_idx / 2 -
                            data_idx / 100):int(data_idx / 2 +
                                                data_idx / 100)])
        self.axes_top.set_xlabel('frequency, Hz')

        # Update the figure
        self.canvas.draw()

        # Data Analysis
        # Calculate and display properties of the frequency
        peak_value = round(np.max(fft_mag), 2)
        self.peak.setText(str(peak_value))
        max_value = np.max(fft_mag)
        max_index = np.argmax(fft_mag)
        bound_high = max_index
        bound_low = max_index
        # print(max_index)
        while 1:
            if fft_mag[bound_low] < 0.5 * max_value:
                break
            bound_low = bound_low - 1
        while 1:
            if fft_mag[bound_high] < 0.5 * max_value:
                break
            bound_high = bound_high + 1
        fwhm_value = bound_high - bound_low
        self.fwhm.setText(str(fwhm_value))

        # Calculate center frequency
        self.center_freq = parameters.get_freq() + (
            (max_index - 5000 / 2) * 250000 / 5000) / 1.0e6
        # 250000 sampling rate, 5000 number of samples for FFT
        self.centerFreq.setText(str(self.center_freq))
Exemplo n.º 11
0
 def open_mri_rt(self):
     self.stop_all()
     self.stacked_widget.setCurrentIndex(7)
     self.mriRtWidget.set_freq(parameters.get_freq())
     self.mriRtWidget.freqValue.setValue(parameters.get_freq())
     self.setWindowTitle('Tabletop MRI - Real-time Rotation GUI')
Exemplo n.º 12
0
 def open_mri_2dimag(self):
     self.stop_all()
     self.stacked_widget.setCurrentIndex(5)
     self.mri2DImagWidget.set_freq(parameters.get_freq())
     self.mri2DImagWidget.freqValue.setValue(parameters.get_freq())
     self.setWindowTitle('Tabletop MRI - 2D Imaging GUI')