# How to change classes labels

**URL:** https://discourse.itk.org/t/how-to-change-classes-labels/6111
**Category:** Beginner Questions
**Tags:** python, simpleitk
**Created:** [July 28, 2023, 5:14pm UTC](https://discourse.itk.org/t/how-to-change-classes-labels/6111 "2023-07-28T17:14:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![NimaY](https://discourse.itk.org/user_avatar/discourse.itk.org/nimay/32/3613_2.png) [@NimaY](https://discourse.itk.org/u/NimaY)
#### Post date: [July 28, 2023, 5:14pm UTC](https://discourse.itk.org/t/how-to-change-classes-labels/6111/1 "2023-07-28T17:14:05Z")

</div>

Hi,  
I have 3 different labels in each masks where the classes order is like that:  
0 - background,  
1 - left lung,  
2 - right lung.  
Is there a way to change it to:  
0 - background,  
1 - both lung?  
All of these masks are 3D masks provided by CT scan.

Thanks.

---

<div class="post-metadata">

### Author: ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)
#### Post date: [July 28, 2023, 5:19pm UTC](https://discourse.itk.org/t/how-to-change-classes-labels/6111/2 "2023-07-28T17:19:52Z")

</div>

Hello @NimaY,

```auto
original_segmentation = ...
segmentation = original_segmentation!=0

```

---

<div class="post-metadata">

### Author: ![NimaY](https://discourse.itk.org/user_avatar/discourse.itk.org/nimay/32/3613_2.png) [@NimaY](https://discourse.itk.org/u/NimaY)
#### Post date: [July 28, 2023, 6:47pm UTC](https://discourse.itk.org/t/how-to-change-classes-labels/6111/3 "2023-07-28T18:47:16Z")

</div>

Thank you for your reply.
