Ejemplo n.º 1
0
def coronal_slice_all( grids, grid_types, subjects_dir=None, subject=None,
                       dpi=150, size=(200, 200) ):
    '''
    takes a dictionary with grid assignments and creates a pdf with
    the coronal slices for these grids
    '''
    pdf_file = ask_user_for_savefile('save pdf file with coronal slice images')

    if pdf_file is None:
        return

    from matplotlib.backends.backend_pdf import PdfPages

    with PdfPages(pdf_file) as pdf:
        for grid in grids:

            if grid_types[grid] != 'depth':
                continue

            electrodes = grids[grid] 
            if len(electrodes) == 0:
                continue

            fig = coronal_slice_grid( electrodes, title=grid,
                subjects_dir=subjects_dir, subject=subject,
                dpi=dpi, size=size )

            pdf.savefig(fig)
Ejemplo n.º 2
0
    def do_coronal_slice(self, info):
        savefile = ask_user_for_savefile('save png file with slice image')

        from electrode_group import coronal_slice_grid
        coronal_slice_grid(self.electrodes, savefile=savefile,
            subjects_dir=self.model.subjects_dir, subject=self.model.subject,
            dpi=self.model.coronal_dpi, 
            size=tuple(self.model.coronal_size),
            title=self.name_stem)
Ejemplo n.º 3
0
def save_coordinates( electrodes, grid_types, snapping_completed=False,
                           file_type='csv'):
    savefile = ask_user_for_savefile(title='save %s file'%file_type)

    if savefile is None:
        return

    if file_type == 'csv':
        save_file_continuation = _save_csv_file
    elif file_type == 'montage':
        save_file_continuation = _save_montage_file

    save_file_continuation(savefile, electrodes, grid_types,
        snapping_completed=snapping_completed)