Menu

EPI, making a new client, Save/Read Data

2014-01-08
2014-02-04
  • Valéry Ozenne

    Valéry Ozenne - 2014-01-08

    Hello,

    I works on Gadgegtron 2.01, Ubunbu 12.04 LTS (as a standalone OS), Siemens VB17. I read in details the notice of Gadgetron looking for specifics answers and I was wondering if you can give some guidelines. I am fully aware that the following questions are not related to installation problems but in case you can help me.

    1) I would like to do EPI with gagdetron but I have to deal with artefacts from EPI sequences. Are there any gadgets already implemented to deal with theses troubles?

    2) After reconstruction using gadgetron ,I would like to send image data to the siemens computer and to one other computer for post processing operation. If I create a "gadget-client" (before ImageFinishGadget for instance) that send the data to the other computer, should I use GadgetronConnector class to do that? In order to implement this communication, I looked in the API class index but I admit that I am currenlty a bit loss with the architecture of gadgetron.

    3) My last question is also related to communication, in order to save the data on the gadgetron computer after/before reconstruction (during the chain reconstruction) on the disk, which class should I use ?

    Thanks in advance.

    Valery

     

    Last edit: Valéry Ozenne 2014-01-08
  • Michael Hansen

    Michael Hansen - 2014-01-08

    Hi Valery,

    Some interesting questions, I might be able to supply you with some partial answers:

    1. We don't have EPI correction in any of the distributed Gadgets right now. Souheil Inati (who might be watching this forum), might have some hints but for right now there is nothing. We would like to have some though if you are interested in contributing something back.

    2. The idea of doing a client Gadget is good and you should, in principle, be able to use the GadgetronConnector, however, there is one problem that may prevent it from working. The GadgetronConnector uses the ACE Reactor framework and so does the Gadgetron and it is really "best" to only have one reactor per process, in this case there would be two. We have run into this problem recently while trying to do something similar and we ended up making a new GadgetronConnector, which doesn't use the reactor framework but just has a reader and a writer task (threads) to manage the communication. If you look at the connector code, you will see that it is pretty straight forward, so you could simply have your client gadget open up a socket to your remote Gadgetron instance and have a thread assigned to receive on the socket and for sending you don't need a thread since the "process" function is called every time data arrives and you could send at that point. Hope this make some sense. Let me know how it goes and if you run into problems, I will try to help.

    3. I have and IsmrmDumpGadget that writes all incoming stuff to disk. It will be included in a soon to come future version of the Gadgetron, but for now I have attached it here and you should be able to add that into the mri_core folder pretty trivially and compile. Hope you can use it.

    Hope these answers helps you move forward a bit. Let us know how it goes.

    Michael

     
  • Valéry Ozenne

    Valéry Ozenne - 2014-01-09

    Hi Michael,

    These answers help me a lot, thanks. I work on it and come back to you. About EPI corrections I am hightly interesting in finding a solution therefore I'm completely ok in contributing but I don't have any specific background on this question.

    Valery

     
  • Valéry Ozenne

    Valéry Ozenne - 2014-02-03

    Hi Michael,

    Thanks for delivering the new version of Gadgetron 2.5. The installation works like a charm.

    In order to do EPI reconstruction, I tried to implement a simple correction on gadgetron but I am stuck. Below, I quickly present/share my problems, I am just looking for guidelines/advises to handle operation on data with gadgetron.

    First, an order inversion of data line is required before data processing. I used the code from CrobAndCombine gadget to create a Gadget called InversionEPI(attached document) to put after AccumulatorGadget. This part was easy but I cannot launch it more than 3 or 4 times, after I got a malloc error. Could you advise me some ways to do this operation properly ?

    Secondly, I must use 3 reference lines without phase encoding starting in the middle of k-space but I didn't find a way to access to them. Let's say I have 128 times 3 + 128 times 128 incoming data (ie kx times ky) coming from a standard EPI sequence from Siemens. Using the ISMRMRD Dump, I can see them in the .h5 file using Matlab at the begin of the dataset.
    But doing the reconstruction process, I think these data are overwriting during the accumulator process because there are identified by their line number (64 in this case). My first try was to allocate a bigger matrix 128 * 131 in accumulator Gadget, copy them to line 129, 130, 131(for instance also using memcpy) in order to transfer them to the next gadget. Is there an easy way to access to these data?

    Which tools/class should I use to do a linear regression in a GadgetContainerMessage?

    Thanks a lot for answering my questions. As soon as it works on Gadgetron, I will switch to more recent EPI corrections.

    Valéry

     

    Last edit: Valéry Ozenne 2014-02-03
    • Souheil Inati

      Souheil Inati - 2014-02-03

      Hi Valere,

      Sorry, been meaning to send you an email for some time. As Michael said, we are working EPI, but it will be some time before the code is ready to be released. You and I can talk off-line and I can bring you up to speed as to where we are.

      What we have done so far is to prototype lots of things in python gadgets. Works really well because we can use numpy, etc. for math. This lets us get going with a working pipeline and then from there we can make it faster by converting to C++. Look at Armadillo. This will let you do some nice things inside the gadgets using Matlab/Numpy style syntax with C++ speed.

      In the meantime, you are correct that basic accumulator will overwrite the reference scans.
      Here’s what I would do to get going quickly:

      1. put the send functor after the siemens readout ft functor, but before the EPI correction, this will give you gridded and ft’ed lines on the gadgetron side
      2. your first gadget needs to handle the EPI reference scans etc. Several ways to do this, one is just brute force counting, you know that the first three are ref lines, etc. The other is to use header flags. There is a flag on the ICE side in the header that indicates that a particular line is a phase correction line. It should show up on the gadgetron side. Once you have done the corrections, you can FT back and stuff into the accumulator.

      UGH. This is going to get too siemens proprietary quickly. Let’s talk off-line. We can set up a google chat.

      Cheers,
      Souheil


      Souheil Inati, PhD
      Staff Scientist
      FMRI Facility
      NIMH/NIH/DHHS
      souheil.inati@nih.govsouheil.inati@nih.gov

      On Feb 3, 2014, at 10:29 AM, Valéry Ozenne val123456@users.sf.netamp#118;amp#97;amp#108;amp#49;amp#50;amp#51;amp#52;amp#53;amp#54;amp#64;amp#117;amp#115;amp#101;amp#114;amp#115;amp#46;amp#115;amp#102;amp#46;amp#110;amp#101;amp#116; wrote:

      Hi Michael,

      Thanks for delivering the new version of Gadgetron 2.5. The installation works like a charm.

      In order to do EPI reconstruction, I tried to implement a simple correction on gadgetron but I am stuck. Below, I quickly present/share my problems, I am just looking for guidelines/advises to handle operation on data with gadgetron.

      First, an order inversion of data line is required before data processing. I used the code from CrobAndCombine gadget to create a Gadget called InversionEPI(attached document) to put after AccumulatorGadget. This part was easy but I cannot launch it more than 3 or 4 times, after I got a malloc error. Could you advise me some ways to do this operation properly ?

      Secondly, I must use 3 reference lines without phase encoding starting in the middle of k-space but I didn't find a way to access to them. Let's say I have 1283 + 128128 incoming data (ie kx * ky) coming from a standard EPI sequence from Siemens. Using the ISMRMRD Dump, I can see them in the .h5 file using Matlab at the begin of the dataset.
      But doing the reconstruction process, I think these data are overwriting during the accumulator process because there are identified by their line number (64 in this case). My first try was to allocate a bigger matrix 128 * 131 in accumulator Gadget, copy them to line 129, 130, 131(for instance also using memcpy) in order to transfer them to the next gadget. Is there an easy way to access to these data?

      Which tools/class should I use to do a linear regression in a GadgetContainerMessage?

      Thanks a lot for answering my questions. As soon as it works on Gadgetron, I will switch to more recent EPI corrections.

      Valéry

      Attachment: InversionEPIGadget.cpp (2.4 kB; text/plain)


      EPI, making a new client, Save/Read Datahttps://sourceforge.net/p/gadgetron/discussion/general/thread/784985f1/?limit=25#897e


      Sent from sourceforge.nethttp://sourceforge.net because you indicated interest in https://sourceforge.net/p/gadgetron/discussion/general/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
    • Michael Hansen

      Michael Hansen - 2014-02-03

      Hi Valery,

      Souheil has already added some comments, so I will just focus on the malloc problem you have. I can't tell you what the problem is from the code that you sent. You likely have a leak somewhere, but I don't think that it is in the code you sent. So when you say that you can start it 3-4 times, do you mean the whole recon or that this Gadget can only be called 3 times?

      If it is the whole recon you can only start 3-4 times, if you monitor the process does it increase in memory foot print between calls?

      Michael

       
  • Valéry Ozenne

    Valéry Ozenne - 2014-02-03

    Hi Souheil,

    Thanks for a so quick answer, I send you an email soon for setting up a google chat.

    Cheers,

    Valery

     
  • Valéry Ozenne

    Valéry Ozenne - 2014-02-04

    Hi Michael,

    I didn't see your post, sorry. It is the whole recon that can only start few times. Nevetheless, if I use a larger image 512*256 (because of the oversampling in the kx dirtection) I still have a malloc error (bellow) without any change in other gadgets. Anyway, I don't want to bother you for that I think I will follow the advise of Souheil and use python gadgets and Numpy to prototype things.

    Cheers,

    Valery

    [........]
    [file /home/valery/Dev/Gadgetron/gadgetron_v2.5.0/gadgets/mri_core/AccumulatorGadget.cpp, line 38] Matrix size: 512, 256, 1
    [file /home/valery/Dev/Gadgetron/gadgetron_v2.5.0/gadgets/mri_core/AccumulatorGadget.cpp, line 46] FOV: 800.000000, 400.000000, 5.000000
    [file /home/valery/Dev/Gadgetron/gadgetron_v2.5.0/toolboxes/gadgettools/GadgetStreamController.cpp, line 81] Received close signal from client. Closing stream...
    [file /home/valery/Dev/Gadgetron/gadgetron_v2.5.0/apps/gadgetron/Gadget.h, line 105] Gadget (>Accumulator) Close Called with flags = 1
    [file /home/valery/Dev/Gadgetron/gadgetron_v2.5.0/apps/gadgetron/Gadget.h, line 115] Gadget (>Accumulator) waiting for thread to finish
    [file /home/valery/Dev/Gadgetron/gadgetron_v2.5.0/apps/gadgetron/Gadget.h, line 105] Gadget (>Accumulator) Close Called with flags = 0
    [file /home/valery/Dev/Gadgetron/gadgetron_v2.5.0/apps/gadgetron/Gadget.h, line 117] Gadget (>Accumulator) thread finished
    [file /home/valery/Dev/Gadgetron/gadgetron_v2.5.0/apps/gadgetron/Gadget.h, line 48] Shutting down Gadget (>Accumulator)
    [file /home/valery/Dev/Gadgetron/gadgetron_v2.5.0/apps/gadgetron/Gadget.h, line 105] Gadget (Epi) Close Called with flags = 1
    [file /home/valery/Dev/Gadgetron/gadgetron_v2.5.0/apps/gadgetron/Gadget.h, line 115] Gadget (Epi) waiting for thread to finish
    gadgetron: malloc.c:2451: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.
    Abandon (core dumped)

     

    Last edit: Valéry Ozenne 2014-02-04
MongoDB Logo MongoDB