question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with Plot label map

See original GitHub issue

Problem Thank you for provide great library:) I have a problem about plotting LabelMap using plot().

To reproduce

def get_data(args):
    print(f'> Getting {args.mode} data.... > Augmentation mode: {args.transform}')
    data_path = os.path.join(args.data_dir, args.hospital)
    
    dataset = MedicalDataset(root_dir=data_path, args=args)
    for data in dataset.training_set:
        one_subject = data
        label = data['label'][tio.DATA]
        print((data['label'][tio.DATA]== 1).nonzero(as_tuple=True))
        one_subject.plot()
    return dataset

class MedicalDataset(Dataset):
    def __init__(self, root_dir, args):
        self.root_dir = root_dir
        self.image_size = args.image_size

        self.subjects = []
        dicom_list = os.listdir(os.path.join(self.root_dir, 'dicom'))
        for dicom_dir in tqdm(dicom_list):
            
            subject = tio.Subject(
                input=tio.ScalarImage(os.path.join(root_dir, 'dicom', dicom_dir)),
                label=tio.LabelMap(os.path.join(root_dir, 'label', dicom_dir+'.nii.gz')),
            )
            self.subjects.append(subject)

        self.training_set = tio.SubjectsDataset(self.subjects)
        print(f'{args.mode} dataset_size:', len(self.training_set), 'subjects')

Expected behavior Large size of segment is shown on plot but, small size of segment is not shown like "Actual behavior. So I check label category on nii.gz file by printing tensor, but there was no probelm. Does it originally working like this?

image

Actual behavior

image

System info

Output of python <(curl -s https://raw.githubusercontent.com/fepegar/torchio/main/print_system.py):

Platform:	Windows-10-10.0.19043-SP0
torchio:	0.18.62
torch:	1.9.1+cu111
numpy:	1.21.2
Python:	3.9.6 | packaged by conda-forge | (default, Jul 11 2021, 03:37:25) [MSC v.1916 64 bit (AMD64)]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
nepersicacommented, Nov 8, 2021

Thank you for your kind answering and fixing problem even though there was a problem talking with me. I wish you every happiness!!☺🌹

1reaction
fepegarcommented, Nov 8, 2021

Alright. You discovered a bug. Thanks for reporting and for sharing your data! I will fix it in a second.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Map function in Excel for Mac - problem with data labels
If I enter the data below, and plot it in Excel using the Map function, and then add data labels that include the...
Read more >
Feature labels not plotting - AutoCAD Map 3D
I have a map I really need to get out the door and I can't because the labels won't plot. -- EB42 Civil...
Read more >
Having issues while annotating labels on map with different ...
When I created my sample_gdf , I set crs=3050 , because I wanted this projection. But now I realised when creating a GeoDataFrame...
Read more >
Adding labels to points plotted on world map in R
In this article, we are going to see how to add labels to points plotted on the world map in R Programming Language....
Read more >
Automatically adjusting map labels - r - GIS Stack Exchange
And a captured image of southerh half of the plot to see how maptools::pointLabel() tries not to overlap labels.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found