Exemplo n.º 1
0
def generate_archive_patient_study_image_set():
    patient11 = PatientFactory()
    patient12 = PatientFactory()
    study111 = StudyFactory(patient=patient11)
    study112 = StudyFactory(patient=patient11)
    study113 = StudyFactory(patient=patient11)
    study121 = StudyFactory(patient=patient12)
    study122 = StudyFactory(patient=patient12)
    images111 = ImageFactoryWithoutImageFile.create_batch(4, study=study111)
    images112 = ImageFactoryWithoutImageFile.create_batch(5, study=study112)
    images113 = ImageFactoryWithoutImageFile.create_batch(6, study=study113)
    images121 = ImageFactoryWithoutImageFile.create_batch(2, study=study121)
    images122 = ImageFactoryWithoutImageFile.create_batch(3, study=study122)
    images211 = ImageFactoryWithoutImageFile.create_batch(4, study=None)
    archive1 = ArchiveFactory.create(
        images=[*images111, *images112, *images113, *images121, *images122])
    archive2 = ArchiveFactory.create(images=images211)
    return ArchivePatientStudyImageSet(
        archive1=archive1,
        patient11=patient11,
        patient12=patient12,
        study111=study111,
        study112=study112,
        study113=study113,
        study121=study121,
        study122=study122,
        images111=images111,
        images112=images112,
        images113=images113,
        images121=images121,
        images122=images122,
        archive2=archive2,
        images211=images211,
    )
Exemplo n.º 2
0
def create_some_datastructure_data(archive_pars=None, ):
    patient_pars = {}
    study_pars = {}
    image_cf_pars = {}
    oct_study_pars = {}
    image_obs_pars = {}
    image_oct_pars = {}

    if archive_pars is None:
        archive_pars = {}

    # Create datastructures
    patient = PatientFactory(**patient_pars)
    study = StudyFactory(patient=patient, **study_pars)
    image_cf = ImageFactoryWithImageFile(
        study=study, modality__modality=settings.MODALITY_CF, **image_cf_pars)
    study_oct = StudyFactory(patient=patient, **oct_study_pars)
    # oct/obs image name has to end with OCT.fds for obs image recognition
    oct_obs_fake_name = "OBS_OCT.fds"
    image_obs = ImageFactoryWithImageFile(
        study=study_oct,
        modality__modality=settings.MODALITY_CF,
        name=oct_obs_fake_name,
        **image_obs_pars,
    )
    image_oct = ImageFactoryWithImageFile(
        study=study_oct,
        modality__modality=settings.MODALITY_OCT,
        name=
        oct_obs_fake_name,  # OCT image name has to be equal to OBS image name
        **image_oct_pars,
    )
    archive = ArchiveFactory.create(images=(image_oct, image_cf, image_obs),
                                    **archive_pars)
    return {
        "archive": archive,
        "patient": patient,
        "study": study,
        "image_cf": image_cf,
        "study_oct": study_oct,
        "image_obs": image_obs,
        "image_oct": image_oct,
    }