User Tools

Site Tools

Writing /dartfs-hpc/rc/lab/rcweb/homes/mvdm/wiki/data/cache/8/8ebd6c14f9c8ecdb29156e592726a3fc.metadata failed


Writing /dartfs-hpc/rc/lab/rcweb/homes/mvdm/wiki/data/cache/1/1677f8539ed86151621db3c35566ef93.metadata failed

[[people:ContactList|ContactList]]\\ [[protocols:Protocols|Protocols]]\\ [[logs:LogSheets|LogSheets]]\\ [[computing:Computing|Computing]]\\ [[protocols:EotW|EotW]]\\ [[protocols:IssueTracker|IssueTracker]]\\ **Reference** [[guides:Guides|HowToGuides]]\\ [[guides:Manuals|Manuals]]\\ [[literature:Literature]]\\ [[jclub:JournalClub|JournalClub]]\\ [[people:LabAlumni|LabAlumni]]\\ [[analysis:DataAnalysis|DataAnalysis]]\\ **Training** [[guides:TheBasics|TheBasics]]\\ [[tutorials:TutorialList|TutorialList]]\\ [[guides:About|About this wiki]] **Beyond the lab** [[Fellowships]]\\ [[Advice for...]]\\ **Admin** [[orphanswanted|OrphansWanted]]\\


===== Artifact Removal ===== A nice artifact detection and removal walkthrough can be found at [[|FieldTrip Artifact Documentation]] ==== Visual Artifact Removal ==== This section addresses visual artifact removal using the FieldTrip toolbox [[|FieldTrip Visual Artifact walkthrough]] Load the data and define the trials as per [[analysis:amplipex|Loading Amplipex data into fieldtrip]]. Once this has been done we can begin by setting up our cfg (configuration) structure and using the ft_databrowser function <code matlab> cfg = data_trl.cfg; = 'all'; cfg.trials = 'all'; cfg.latency = 'maxperlength'; cfg.method = 'Summary'; cfg.keepchannel = 'yes'; cfg.metric = 'var'; cfg.alim = []; cfg.coninuous = 'yes'; cfg.viewmode = 'vertical'; % this shows all of the channels vertically cfg = ft_databrowser(cfg,data_trl); data_trl.cfg = cfg; % rewrite the cfg back into the data set </code> The browser will let you scroll through the trials and use the cursor to highlight a section of the data containing an artifact. {{:analysis:amplipex:artifact_wiki.png?750|}} The selected artifact regions are not altered within the data itself, instead the start and end of each artifact are saved as part of the cfg structure: data_trl.cfg.artfctdef.visual.artifact . So now can change these regions to any value of our choice. <code matlab> %% Mannual Artifact removal art_value = 0; %Value to replace the data within artifact regions artifacts = data_trl.cfg.artfctdef.visual.artifact; trials = data_trl.cfg.trl; for iArt = 1:length(artifacts) for iTrial = 1:length(trials) if trials(iTrial,1)<= artifacts(iArt,1) && trials(iTrial,2)>= artifacts(iArt,2) if artifacts(iArt,1)-trials(iTrial,1) ==0 data_trl.trial{1,iTrial}(1:16,(1:artifacts(iArt,2)-trials(iTrial,1)))=art_value; else data_trl.trial{1,iTrial}(1:16,(artifacts(iArt,1)-trials(iTrial,1):artifacts(iArt,2)-trials(iTrial,1)))=art_value; end end end end </code> Now we can visualize the data regions that have been replaced to ensure they have been correctly converted. <code matlab> cfg.viewmode = 'vertical'; % this shows all of the channels vertically ft_databrowser(cfg,data_trl); </code> From here we can run any further ft analysis.

analysis/amplipex/artifacts.txt · Last modified: 2018/04/17 15:20 (external edit)