add some rich to the simple dicom checking
This commit is contained in:
@@ -4,29 +4,27 @@ from django.core.management.base import BaseCommand, CommandError
|
||||
import pydicom
|
||||
import pydicom.errors
|
||||
|
||||
from django_rich.management import RichCommand
|
||||
|
||||
from rich.progress import track
|
||||
|
||||
import six
|
||||
import os
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(RichCommand):
|
||||
help = 'Checks dicom files for anonymisation'
|
||||
|
||||
#def add_arguments(self, parser):
|
||||
# parser.add_argument('poll_ids', nargs='+', type=int)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
#for poll_id in options['poll_ids']:
|
||||
# try:
|
||||
# poll = Poll.objects.get(pk=poll_id)
|
||||
# except Poll.DoesNotExist:
|
||||
# raise CommandError('Poll "%s" does not exist' % poll_id)
|
||||
self.console.print("[bold blue]Finding files:[/bold blue]")
|
||||
|
||||
# poll.opened = False
|
||||
# poll.save()
|
||||
|
||||
# self.stdout.write(self.style.SUCCESS('Successfully closed poll "%s"' % poll_id))
|
||||
files = get_all_media()
|
||||
|
||||
for file in files:
|
||||
self.console.print(f"[bold blue]Files to check: {len(files)}[/bold blue]")
|
||||
|
||||
for file in track(files, description="Checking file..."):
|
||||
try:
|
||||
ds = pydicom.dcmread(file, force=False)
|
||||
except pydicom.errors.InvalidDicomError:
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ INSTALLED_APPS = [
|
||||
"django_filters",
|
||||
"easy_thumbnails",
|
||||
"filer",
|
||||
"mptt",
|
||||
#"mptt",
|
||||
"sortedm2m",
|
||||
"dal",
|
||||
"dal_select2",
|
||||
|
||||
+2
-1
@@ -35,4 +35,5 @@ debugpy
|
||||
git+https://github.com/jazzband/django-cookie-consent#django-cookie-consent
|
||||
django-crispy-forms
|
||||
django-ninja
|
||||
crispy-bootstrap4
|
||||
crispy-bootstrap4
|
||||
django-rich
|
||||
Reference in New Issue
Block a user