Skip to content

Conversation

@MichaelStritt
Copy link
Contributor

Linked issue

Check out #566

@MichaelStritt MichaelStritt added the feature New feature, enhancement or request label Jul 1, 2021
@MichaelStritt MichaelStritt added this to the Release 1.8.0 milestone Jul 1, 2021
@MichaelStritt MichaelStritt linked an issue Jul 1, 2021 that may be closed by this pull request
@BeatrizPadrela
Copy link
Contributor

BeatrizPadrela commented Jul 1, 2021

Ok, when inducing motion to the first volume, to clearly see if some motion correction was being done, it was not working at all. No motion correction was being applied even if the rp_file was okay.
So I tried to run the motion correction without this specific motion correction for multi-tE, so the normal motion correction approach, only with a single line that defines zigzag=false to multiPLD data, and it worked!!

(difference between volume 0 and volume 8 - before - ASL4D.nii)
image

(difference between volume 0 and volume 8 - after - rASL4D.nii)
image

[this was the way I found to show the difference between vol0 and vol8, but if we open the images with fsleyes is really clear that there's no motion after the normal motion correction]

@jan-petr is this enough? I have to show you

@MichaelStritt MichaelStritt requested a review from jan-petr July 1, 2021 14:01
Copy link
Contributor

@jan-petr jan-petr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good. Except the HadamardType...

Copy link
Contributor

@jan-petr jan-petr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

@jan-petr jan-petr assigned jan-petr and unassigned BeatrizPadrela Jul 2, 2021
@jan-petr jan-petr force-pushed the feature-#566_HadamardMotionCorrection branch from 352fa81 to af3d8d7 Compare July 2, 2021 09:48
@jan-petr jan-petr merged commit af3d8d7 into develop Jul 2, 2021
@jan-petr jan-petr deleted the feature-#566_HadamardMotionCorrection branch July 2, 2021 09:49
%
% FORMAT: xASL_im_Move3DVolume(pathNifti, pathResult, dim, volNum, numVoxel)
%
% INPUT: pathNifti (CHAR ARRAY, REQUIRED)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BeatrizPadrela You need to explain a bit here what the input arguments mean, not only their format.

% Define realignment settings
tempnii = xASL_io_ReadNifti(InputPath);
nFrames = double(tempnii.hdr.dim(5));
if length(x.EchoTime)>1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BeatrizPadrela This could go wrong for non-multi-TE sequences. The EchoTime can also be (incorrectly) a vector in enhanced DICOM. So we need to add a boolean like if bMultiEcho

% Run SPM
if nFrames>2 && bSubtraction

%####### Calculating the motion for every first TE of each PLD and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BeatrizPadrela #### is for languages like Bash, %%%% for Matlab :)

%####### Calculating the motion for every first TE of each PLD and
% considering it the same for the other TEs from that PLD.
%
% if nFrames>2 && bSubtraction && length(x.EchoTime)>1 %Multi TE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BeatrizPadrela So this should also start with something like if bMultiEcho. Makes it less prone to error and also easier to read

% considering it the same for the other TEs from that PLD.
%
% if nFrames>2 && bSubtraction && length(x.EchoTime)>1 %Multi TE
% uniqueTE=uniquetol(x.EchoTime); %gives the number of unique TEs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BeatrizPadrela Should we really use uniquetol here or would unique be better? We haven't specified the tolerance here...

% uniqueTE=uniquetol(x.EchoTime); %gives the number of unique TEs
% NumTEs=numel(uniqueTE);
% minTE=min(uniqueTE);
% positionMinTE=find(x.EchoTime == minTE); %positions that have the min TE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BeatrizPadrela At some locations in this script we use TE at other locations EchoTime, though they mean the same right? Would be good to homogenize for readability.

% if numel(unique(x.Q.Initial_PLD))==1 %multiTE + single PLD
% spm_realign(ImInfoFirstTEs,flags,true);
% MotionFirstTEs=load(rpfile);
% MotionAllTEs=repelem(MotionFirstTEs(:,:),NumTEs,1); %repeats each row NumTEs times
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BeatrizPadrela Is this also possible with repmat? Is a bit more backward compatible.

% spm_realign(ImInfoFirstTEs,flags,false);
% MotionFirstTEs=load(rpfile);
% MotionAllTEs=repelem(MotionFirstTEs(:,:),NumTEs,1);
% save('rp_ASL4D.txt','MotionAllTEs','-ascii')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

; missing


% Summarize real-world realign parameters into net displacement vector (NDV)
rp = load(rpfile, '-ascii'); % load the 3 translation and 3 rotation values
MeanRadius = 50; % typical distance center head to cerebral cortex (Power et al., NeuroImage 2012)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BeatrizPadrela Apparently, this needs adaptation in some cases. Something for the future :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature, enhancement or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hadamard_MotionCorrection

5 participants