How to recognize RPI coordination?

 Dear Beijing Normal University Team,

 Thank you for your excellent software REST and DPARSF.
But how do you recognize RPI or not?
In rest_readfile code of REST, 
if Header.mat(1,1)>0
Outdata = flipdim(Outdata,1);
Header.mat(1,:) = -1*Header.mat(1,:);
if Header.mat(2,2)<0
Outdata = flipdim(Outdata,2);
Header.mat(2,:) = -1*Header.mat(2,:);
end
if Header.mat(3,3)<0
Outdata = flipdim(Outdata,3);
Header.mat(3,:) = -1*Header.mat(3,:);
end.
Questions:So I guess RPI is recognized by the header.mat with diagonal sign -, +, +, is it right?
Can header.mat represent RPI or not? But if I mannually modify the diagonal sign, the displays of any img brain do not change at all.
So I worry is it a safe judgement in rest_readfile?

Thank you all very much!

You are right, RPI is recognized by the header.mat with diagonal sign -, +, +.
In addition, REST Slice Viewer does not support the images which include an rotation transformation in the header.mat currently.

How do you mannually modify the diagonal sign?
The following is an example, you can try it. And you can find the left and right in 00000001.img and Flip00000001.img are different as viewing in REST Slice Viewer.
[Data Vox Head]=rest_readfile('00000001.img');
HeadF=Head;
HeadF.mat(1,:)=-1*HeadF.mat(1,:)
rest_WriteNiftiImage(Data,HeadF,'Flip00000001.img')

 As though in the last discussion: RPI is recognized by the header.mat with diagonal sign -, +, +. 
Question 1: Is it a universe/general mark or only right just for REST and DPARSF software?
Because I found the header.mat in files with LPI  was also with diagonal sign -, +, +. 

Question 2: Did you change the header.mat of the 1mm AAL from MRIcroN for application in DPARSF? I saw the two 1mm AAL were the same but the header.mat.

Thanks a lot!!!




1. For REST and DPARSF. You can write to AFNI/SPM/FSL to check what standard they used.
RPI and LPI corresponds to how the data is stored in .img!!! How do you know your .img is LPI when the diagonal sign is -, +, +?
You need to clarify the concept of LPI and RPI.
2. AAL_61x73x61_YCG.nii is 3*3*3 down sampled from aal.nii.
    aal.nii stored the data in LPI with diagonal sign +, +, +.
    AAL_61x73x61_YCG.nii flipped the data into RPI and the diagonal sign changed to -, +, +.
    For those software which recognized the NIfTI format (such as REST/AFNI/SPM), they know how to deal with this flipping and sign, and you will not encounter any problem. But if you use your own scripts to read/write image, please be cautious.

1. a) "How do you know your .img is LPI when the diagonal sign is -, +, +?"
 
          You mean LPI => the diagonal sign is +, +, +, and RPI => the diagonal sign is -, +, +, but they are wrong when opposed?

     b) A .img is RPI or LPI, right? How did I know, I opened a img (preprocessed by SPM2 ) in MRIcroN, and the left side is the right brain, right side is the left brain. Q: could not I thought it was LPI?  But, the diagonal sign is -, +, +.  so Q: what's it?

  2. The header.mat in aal.nii (DPARSF) and aal (.hdr, .img, MRIcro) are
          aal.nii (DPARSF)                                                      
      1 0 0 -91                                   

      0 1 0 -126        
      0 0 1 -72
      0 0 0 1
         aal (MRIcro)

     -1 0 0 90
      0 1 0 -126
      0 0 1 -72
      0 0 0 1
Q: why are they different? one is LPI, the other is RPI?  I opened them in MIRcroN, they were with the same direction.
So Q: What are they?

Thanks!

 

1. For NIfTI images without rotation matrix, LPI => the diagonal sign is +, +, +, and RPI => the diagonal sign is -, +, +, and they are right when opposed.
2. A .img is RPI or LPI, right? YES
    How did I know, I opened a img (preprocessed by SPM2 ) in MRIcroN, and the left side is the right brain, right side is the left brain. Q: could not I thought it was LPI?  NO
    But, the diagonal sign is -, +, +.  so Q: what's it? RPI
3. Q: why are they different? one is LPI, the other is RPI?  YES
    I opened them in MIRcroN, they were with the same direction. Because MRIcroN knows how to display the image in the right way no matter it is RPI or LPI or even LAI.

Basically: please clarify what RPI and LPI are. 
To my knowledge, RPI and LPI correspond what your data stored (.img). How the data displayed is another issue.
If you use NIfTI images, you can forget what RPI and LPI are, cause the software know how to deal with. This is different from ANALYZE.

This is a final post:

So, what are RPI and LPI? I means how do they store img data?
Do you have some stuff about storage principles of img data? If you have, would you like to send some to me?

According to your answer, we can not judge which is LPI or RPI through displaying in MRIcorN. But...,
a) As I learned from that document you sent me, LPI is Radiological convention meaning left side of brain is on the right, otherwise known as RPI.
b) MRIcroN displays the real orientation of brain.
c) So I think we could judge RPI or LPI by MRIcroN displaying. However, there came out a contradiction as depicted in last post of this topic.
So, which is safer judgment?

Thanks!

There are two DISTINCT things:
1. The way the data is stored in .img.
2. The way the data is displayed in software such as MRIcroN, REST, SPM, AFNI.

For the first thing, there are lots of ways to store the data, such as LPI, RAI, LAS, RAS, LPS....
For the second thing, there are usually TWO ways: i) Radiological convention (left hemisphere of brain is displayed on the right side of picture); ii) Neurological convention (left hemisphere of brain is displayed on the left side of picture)

No matter what way you stored your data, MRIcroN can display the data in the correct Radiological or Neurological convention as you required. Thus, you can not know how the data is stored just from how the image is displayed.

Thank you very very much for your these replies.
... ...
But I am sorry it's that question: what is RPI or LPI?

would you like to give me more clear explanation or suggest me some clear stuff (book or any OK)?

I think it's an important question, because in REST,
: flipping the img when it is not RPI in REST?
In rest_readfile code of REST, 
if Header.mat(1,1)>0
Outdata = flipdim(Outdata,1);
Header.mat(1,:) = -1*Header.mat(1,:);

Thank you again! And sorry again. So many questions.

Please google it.
The data can be stored in RAS, LPI, RPI, LAS, LAI, .... in .img, and this information will be recorded in the Header.mat.

if Header.mat(1,1)>0                                       Test if the data is stored in L, if then do the following steps
Outdata = flipdim(Outdata,1);                          flip the data in to R
Header.mat(1,:) = -1*Header.mat(1,:);
            change the information in Header.mat from L to R

REST need to display the Data in Radiology convention, thus need to flip the data.
Please think it carefully, and do some simulations in matlab, try to understand it before suspect, then ask.

Thank you very very much for your so many responses.
I did not suspect but discussed for depth and cautious.
I know what you said but don't know what you did not think what I thought.

Thanks again.

Error | Forum of resting-state fMRI

Error

The website encountered an unexpected error. Please try again later.