Merging segmentation data into one file?

1,675 views
Skip to first unread message

Guy

unread,
Sep 20, 2010, 9:41:24 PM9/20/10
to itksnap-users
In error, I segmented two regions of the same greyscale series into 2
different segmentation files. Is there a way to merge the 2
segmentation files so the 2 segmented regions are in the same file?

Paul Yushkevich

unread,
Sep 20, 2010, 10:28:49 PM9/20/10
to itksna...@googlegroups.com
Yes you can do it in c3d.

C3d a.nii b.nii -replace 1 2 -add -o c.nii

Sent from my iPod

> --
> You received this message because you are subscribed to the Google Groups "itksnap-users" group.
> To post to this group, send email to itksna...@googlegroups.com.
> To unsubscribe from this group, send email to itksnap-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/itksnap-users?hl=en.
>

Guy

unread,
Sep 22, 2010, 11:06:00 PM9/22/10
to itksnap-users
Thanks. I'm still using v1.8. Can I still use c3d?

Guy


On Sep 20, 10:28 pm, Paul Yushkevich <pyushkev...@gmail.com> wrote:
> Yes you can do it in c3d.
>
> C3d a.nii b.nii -replace 1 2 -add -o c.nii
>
> Sent from my iPod
>

Paul Yushkevich

unread,
Sep 23, 2010, 7:16:15 PM9/23/10
to itksna...@googlegroups.com
Sure, they are separate downloads (c3d is at itksnap.org/c3d)

Is 2.0 giving you trouble, or are you sticking to 1.8 for protocol consistency?

Paul.
--
Paul A. Yushkevich, Ph.D.
Assistant Professor
Penn Image Computing and Science Laboratory
Department of Radiology
University of Pennsylvania

Guy

unread,
Sep 23, 2010, 9:01:59 PM9/23/10
to itksnap-users
Protocol consistency.


>C3d a.nii b.nii -replace 1 2 -add -o c.nii

I assume a.nii and b.nii are the two files I wish to combine, and
c.nii is the name I want to give to the new file that now has the
combined data. Is that correct.

Also, do 1 2 represent the label IDs of the regions I wish to
combine? In my OP, for simplicity I said there were 2 regions, but
there are actually 5 regions...2 regions on one file and 3 on the
other. So if my regions I want in the combined file are labeled 1, 3,
4, 6 and 7 then I would write: C3d a.nii b.nii -replace 1 3 4 6 7 -
add -o c.nii ?

I'm not real experienced with using cmd, so I hope my questions aren't
too basic. But, will the a.nii and b.nii files be affected at all in
creating the c.nii file? Also, do the a.nii and b.nii files need to
be in the folder c3d-0.8.2\bin?

Thanks,
Guy

On Sep 23, 7:16 pm, Paul Yushkevich <pau...@mail.med.upenn.edu> wrote:
> Sure, they are separate downloads (c3d is at itksnap.org/c3d)
>
> Is 2.0 giving you trouble, or are you sticking to 1.8 for protocol
> consistency?
>
> Paul.
>
>
>
> On Thu, Sep 23, 2010 at 11:06 AM, Guy <glombard...@optonline.net> wrote:
> > Thanks.  I'm still using v1.8.  Can I still use c3d?
>
> > Guy
>
> > On Sep 20, 10:28 pm, Paul Yushkevich <pyushkev...@gmail.com> wrote:
> > > Yes you can do it in c3d.
>
> > > C3d a.nii b.nii -replace 1 2 -add -o c.nii
>
> > > Sent from my iPod
>
> > > On Sep 21, 2010, at 9:41 AM, Guy <glombard...@optonline.net> wrote:
>
> > > > In error, I segmented two regions of the same greyscale series into 2
> > > > different segmentation files.  Is there a way to merge the 2
> > > > segmentation files so the 2 segmented regions are in the same file?
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups "itksnap-users" group.
> > > > To post to this group, send email to itksna...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > itksnap-user...@googlegroups.com<itksnap-users%2Bunsu...@googlegroups.com>
> > .
> > > > For more options, visit this group athttp://
> > groups.google.com/group/itksnap-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "itksnap-users" group.
> > To post to this group, send email to itksna...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > itksnap-user...@googlegroups.com<itksnap-users%2Bunsu...@googlegroups.com>
> > .

Paul Yushkevich

unread,
Sep 24, 2010, 2:28:31 AM9/24/10
to itksna...@googlegroups.com
Hi

>C3d a.nii b.nii -replace 1 2 -add -o c.nii

this command means
- load a
- load b
- replace label 1 in b with label 2
- add a and b and save as c

(see itksnap.org/c3d for documentation)

Now let's say you have in a.nii label 1 for left hippo, 2 for left amygdala, 3 for left thalamus and in b.nii you have 1 for right hippo, 2 for left amygdala, etc. Run

c3d a.nii b.nii -replace 1 4 2 5 3 6 -add -o c.nii

or

c3d a.nii b.nii -shift 4 -add -o c.nii

Paul

To unsubscribe from this group, send email to itksnap-user...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/itksnap-users?hl=en.

Guy

unread,
Sep 24, 2010, 9:19:06 PM9/24/10
to itksnap-users
OK, I think I get it. So that means if label 1 is left hippo, 2 is
left amygdala,
3 is left thalamus, and if in a.nii I segmented 1 and 2, and in b.nii
I segmented 3, then I would run

c3d a.nii b.nii -add -o c.nii ? Is that right?

Thanks,
Guy
> > <itksnap-users%2Bunsu...@googlegroups.com<itksnap-users%252Buns...@googlegroups.com>
>
> > > > .
> > > > > > For more options, visit this group athttp://
> > > > groups.google.com/group/itksnap-users?hl=en.
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "itksnap-users" group.
> > > > To post to this group, send email to itksna...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > itksnap-user...@googlegroups.com<itksnap-users%2Bunsu...@googlegroups.com>
> > <itksnap-users%2Bunsu...@googlegroups.com<itksnap-users%252Buns...@googlegroups.com>

Pokorny, Saskia

unread,
Sep 30, 2010, 9:23:44 AM9/30/10
to itksna...@googlegroups.com

Hello together,

 

I am just starting to use ITK snap and was wondering, if it is possible to manually select a couple of slices that define regions the automatic selection has to meet? (I do not want to use the manual selected regions as starting point for the snake, rather I would like that they present boundary conditions for my snake in the automatic selction?). This would be of great help to me.

I am trying to create a model of the different regions of the heart (ventricle, atrium, myocardium) using ITK Snap. At the moment I am always having the problem, that the contrast between the different regions is very low. Therefore I was not able to successfully segmentat the different regions until now. I would appreciate any kind of help or ideas very much!

 

Best Regards

 

Saskia

 

 

 

Dipl. Ing. Saskia Pokorny

Lehrstuhl für Experimentelle

Herzchirurgie und Herzklappenersatz

UKSH, Campus Kiel

Klinik für Herz- und Gefäßchirurgie

Arnold-Heller-Str.3, Hs 17

D-24105 Kiel

 

Tel: +49 431 597 5010

Fax: +49 431 597 4249

E-Mail: saskia....@uksh-kiel.de

 

 


Universitätsklinikum Schleswig-Holstein
Rechtsfähige Anstalt des öffentlichen Rechts der Christian-Albrechts-Universität zu Kiel und der Universität zu Lübeck

Vorstandsmitglieder: Prof. Dr. Jens Scholz (Vorsitzender), Peter Pansegrau, Christa Meyer
Vorsitzende des Aufsichtsrates: Dr. Cordelia Andreßen
Bankverbindungen: Förde Sparkasse BLZ 210 501 70 Kto.-Nr. 100 206, Commerzbank AG BLZ 230 800 40 Kto.-Nr. 300 041 200

Diese E-Mail enthält vertrauliche Informationen und ist nur für die Personen bestimmt, an welche sie gerichtet ist. Sollten Sie nicht
der bestimmungsgemäße Empfänger sein, bitten wir Sie, uns hiervon unverzüglich zu unterrichten und die E-Mail zu vernichten.
Wir weisen darauf hin, dass der Gebrauch und die Weiterleitung einer nicht bestimmungsgemäß empfangenen E-Mail und ihres
Inhalts gesetzlich verboten sind und ggf. Schadensersatzansprüche auslösen können.

Paul Yushkevich

unread,
Sep 30, 2010, 10:07:57 AM9/30/10
to itksna...@googlegroups.com
Hi Saskia

That's not presently a feature, unfortunately. You can however, mask your segmentation with hand segmentations. You can draw some polygons to define your region of interest with label 2. Then before running automatic segmentation, select label 1 as the "drawing label" and label 2 as the "draw over" label. This way, when you "finish" your active contour segmentation, it will only be applied to the voxels that have label 2. You would need to label the ROI on every slice where you want to run active contours, but you can do this quickly in polygon mode using the "paste" button.

Hope this helps!
Paul.

--
You received this message because you are subscribed to the Google Groups "itksnap-users" group.
To post to this group, send email to itksna...@googlegroups.com.
To unsubscribe from this group, send email to itksnap-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/itksnap-users?hl=en.

Runa Unsgård

unread,
Apr 13, 2021, 6:32:55 AM4/13/21
to itksnap-users
Hi!
I made the same error. Is there a way to merge the segmentation files into one file in the itk snap program?

Runa

Paul Yushkevich

unread,
Apr 14, 2021, 8:58:07 AM4/14/21
to itksna...@googlegroups.com
Yes, it is easy to do with c3d, please see above for examples of using c3d to merge labels between multiple files.

Paul

To unsubscribe from this group and stop receiving emails from it, send an email to itksnap-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/itksnap-users/36368404-c149-42a6-b7aa-e5544293158dn%40googlegroups.com.


--
Paul A. Yushkevich, Ph.D.
Professor of Radiology

Penn Image Computing and Science Laboratory
University of Pennsylvania Perelman School of Medicine
Reply all
Reply to author
Forward
0 new messages