Exemple #1
0
    def setUp(self):
        self.test_path = os.path.abspath(os.path.dirname(__file__))
        self.user = User.objects.create(username='******')
        self.client = Client()
        self.client.login(username=self.user)
        self.Collection1 = Collection(name='Collection1', owner=self.user)
        self.Collection1.save()
        self.unorderedAtlas = Atlas(name='unorderedAtlas',
                                    description='',
                                    collection=self.Collection1)

        # Save new atlas object, unordered
        print "Adding unordered and ordered atlas..."
        nii_path = os.path.join(
            self.test_path,
            'test_data/api/VentralFrontal_thr75_summaryimage_2mm.nii.gz')
        xml_path = os.path.join(
            self.test_path,
            'test_data/api/unordered_VentralFrontal_thr75_summaryimage_2mm.xml'
        )
        self.unorderedAtlas = save_atlas_form(nii_path=nii_path,
                                              xml_path=xml_path,
                                              collection=self.Collection1,
                                              name="unorderedAtlas")
        # Ordered
        nii_path = os.path.join(
            self.test_path,
            'test_data/api/VentralFrontal_thr75_summaryimage_2mm.nii.gz')
        xml_path = os.path.join(
            self.test_path,
            'test_data/api/VentralFrontal_thr75_summaryimage_2mm.xml')
        self.orderedAtlas = save_atlas_form(nii_path=nii_path,
                                            xml_path=xml_path,
                                            collection=self.Collection1,
                                            name="orderedAtlas")

        # Statistical Map 1 and 2
        print "Adding statistical maps..."
        nii_path = os.path.join(self.test_path,
                                'test_data/statmaps/motor_lips.nii.gz')
        self.Image1 = save_statmap_form(image_path=nii_path,
                                        collection=self.Collection1)
        nii_path = os.path.join(self.test_path,
                                'test_data/statmaps/beta_0001.nii.gz')
        self.Image2 = save_statmap_form(image_path=nii_path,
                                        collection=self.Collection1)

        # Zip file with nidm results
        print "Adding nidm results..."
        zip_file = os.path.join(self.test_path,
                                'test_data/nidm/spm_example.nidm.zip')
        self.nidm = save_nidm_form(zip_file=zip_file,
                                   collection=self.Collection1)
Exemple #2
0
    def setUp(self):
        self.test_path = os.path.abspath(os.path.dirname(__file__))
        self.user = User.objects.create(username='******')
        self.client = Client()
        self.client.login(username=self.user)
        self.Collection1 = Collection(name='Collection1', owner=self.user)
        self.Collection1.save()
        self.unorderedAtlas = Atlas(
            name='unorderedAtlas', description='', collection=self.Collection1)

        # Save new atlas object, unordered
        print "Adding unordered and ordered atlas..."
        nii_path = os.path.join(
            self.test_path, 'test_data/api/VentralFrontal_thr75_summaryimage_2mm.nii.gz')
        xml_path = os.path.join(
            self.test_path, 'test_data/api/unordered_VentralFrontal_thr75_summaryimage_2mm.xml')
        self.unorderedAtlas = save_atlas_form(nii_path=nii_path,
                                              xml_path=xml_path,
                                              collection=self.Collection1,
                                              name="unorderedAtlas")
        # Ordered
        nii_path = os.path.join(
            self.test_path, 'test_data/api/VentralFrontal_thr75_summaryimage_2mm.nii.gz')
        xml_path = os.path.join(
            self.test_path, 'test_data/api/VentralFrontal_thr75_summaryimage_2mm.xml')
        self.orderedAtlas = save_atlas_form(nii_path=nii_path,
                                            xml_path=xml_path,
                                            collection=self.Collection1,
                                            name="orderedAtlas")

        # Statistical Map 1 and 2
        print "Adding statistical maps..."
        nii_path = os.path.join(
            self.test_path, 'test_data/statmaps/motor_lips.nii.gz')
        self.Image1 = save_statmap_form(
            image_path=nii_path, collection=self.Collection1)
        nii_path = os.path.join(
            self.test_path, 'test_data/statmaps/beta_0001.nii.gz')
        self.Image2 = save_statmap_form(
            image_path=nii_path, collection=self.Collection1)

        # Zip file with nidm results
        print "Adding nidm results..."
        zip_file = os.path.join(
            self.test_path, 'test_data/nidm/spm_example.nidm.zip')
        self.nidm = save_nidm_form(
            zip_file=zip_file, collection=self.Collection1)
    def setUp(self):
        super(TestAtlasChange, self).setUp()

        nii_path = self.abs_data_path(
            'api/VentralFrontal_thr75_summaryimage_2mm.nii.gz')
        xml_path = self.abs_data_path(
            'api/unordered_VentralFrontal_thr75_summaryimage_2mm.xml')
        self.item = save_atlas_form(nii_path=nii_path,
                                    xml_path=xml_path,
                                    collection=self.coll,
                                    name="unorderedAtlas")

        self.item_url = '/api/atlases/%s/' % self.item.pk
Exemple #4
0
    def setUp(self):
        super(TestAtlasChange, self).setUp()

        nii_path = self.abs_file_path(
            'test_data/api/VentralFrontal_thr75_summaryimage_2mm.nii.gz'
        )
        xml_path = self.abs_file_path(
            'test_data/api/unordered_VentralFrontal_thr75_summaryimage_2mm.xml'
        )
        self.item = save_atlas_form(nii_path=nii_path,
                                    xml_path=xml_path,
                                    collection=self.coll,
                                    name="unorderedAtlas")

        self.item_url = '/api/atlases/%s/' % self.item.pk
    def setUp(self):
        print "\n#### TESTING THRESHOLDED IMAGES IN COMPARISON\n"
        self.tmpdir = tempfile.mkdtemp()
        self.app_path = os.path.abspath(os.path.dirname(__file__))
        self.u1 = User.objects.create(username='******')
        self.comparisonCollection1 = Collection(name='comparisonCollection1', owner=self.u1,
                                                DOI='10.3389/fninf.2015.00008')
        self.comparisonCollection1.save()
        self.comparisonCollection2 = Collection(name='comparisonCollection2', owner=self.u1,
                                                DOI='10.3389/fninf.2015.00009')
        self.comparisonCollection2.save()
        self.comparisonCollection3 = Collection(name='comparisonCollection3', owner=self.u1,
                                                DOI='10.3389/fninf.2015.00010')
        self.comparisonCollection3.save()
        self.comparisonCollection4 = Collection(name='comparisonCollection4', owner=self.u1,
                                                DOI='10.3389/fninf.2015.00011')
        self.comparisonCollection4.save()
        
        # Image 1 is an atlas
        print "Adding atlas image..."
        nii_path = os.path.join(self.app_path,"test_data/api/VentralFrontal_thr75_summaryimage_2mm.nii.gz")
        xml_path = os.path.join(self.app_path,"test_data/api/VentralFrontal_thr75_summaryimage_2mm.xml")
        image1 = save_atlas_form(nii_path=nii_path,xml_path=xml_path,collection = self.comparisonCollection1)
        self.pk1 = image1.id

        # Image 2 is a statistical map
        print "Adding statistical map..."
        image_path = os.path.join(self.app_path,'test_data/statmaps/beta_0001.nii.gz')
        image2 = save_statmap_form(image_path=image_path,collection = self.comparisonCollection2)
        self.pk2 = image2.id
        
        # Image 3 is a thresholded statistical map
        print "Adding thresholded statistical map..."
        image_paths = [os.path.join(self.app_path,'test_data/statmaps/box_0b_vs_1b.img'),
                       os.path.join(self.app_path,'test_data/statmaps/box_0b_vs_1b.hdr')]
        image3 = save_statmap_form(image_path=image_paths, collection = self.comparisonCollection3,ignore_file_warning=True)
        self.pk3 = image3.id

        # Create similarity object
        Similarity.objects.update_or_create(similarity_metric="pearson product-moment correlation coefficient",
                                         transformation="voxelwise",
                                         metric_ontology_iri="http://webprotege.stanford.edu/RCS8W76v1MfdvskPLiOdPaA",
                                         transformation_ontology_iri="http://webprotege.stanford.edu/R87C6eFjEftkceScn1GblDL")
        self.pearson_metric = Similarity.objects.filter(similarity_metric="pearson product-moment correlation coefficient",
                                         transformation="voxelwise",
                                         metric_ontology_iri="http://webprotege.stanford.edu/RCS8W76v1MfdvskPLiOdPaA",
                                         transformation_ontology_iri="http://webprotege.stanford.edu/R87C6eFjEftkceScn1GblDL")        
Exemple #6
0
    def setUp(self):
        self.user = User.objects.create_user('NeuroGuy')
        self.user.save()
        self.collection = Collection(owner=self.user, name="Test Collection")
        self.collection.save()

        self.unorderedAtlas = save_atlas_form(
            nii_path=self.abs_data_path(
                'api/VentralFrontal_thr75_summaryimage_2mm.nii.gz'
            ),
            xml_path=self.abs_data_path(
                'api/unordered_VentralFrontal_thr75_summaryimage_2mm.xml'
            ),
            collection=self.collection,
            name="unorderedAtlas"
        )

        self.image1 = save_statmap_form(
            image_path=self.abs_data_path(
                'statmaps/motor_lips.nii.gz'
            ),
            collection=self.collection
        )

        self.image2 = save_statmap_form(
            image_path=self.abs_data_path(
                'statmaps/beta_0001.nii.gz'
            ),
            collection=self.collection
        )

        self.nidm = save_nidm_form(
            zip_file=self.abs_data_path(
                'nidm/spm_example.nidm.zip'
            ),
            collection=self.collection
        )
    def setUp(self):
        print "\n#### TESTING THRESHOLDED IMAGES IN COMPARISON\n"
        self.tmpdir = tempfile.mkdtemp()
        self.app_path = os.path.abspath(os.path.dirname(__file__))
        self.u1 = User.objects.create(username='******')
        self.comparisonCollection = Collection(name='comparisonCollection',owner=self.u1)
        self.comparisonCollection.save()
        
        # Image 1 is an atlas
        print "Adding atlas image..."
        nii_path = os.path.join(self.app_path,"test_data/api/VentralFrontal_thr75_summaryimage_2mm.nii.gz")
        xml_path = os.path.join(self.app_path,"test_data/api/VentralFrontal_thr75_summaryimage_2mm.xml")
        image1 = save_atlas_form(nii_path=nii_path,xml_path=xml_path,collection = self.comparisonCollection)
        self.pk1 = image1.id

        # Image 2 is a statistical map
        print "Adding statistical map..."
        image_path = os.path.join(self.app_path,'test_data/statmaps/beta_0001.nii.gz')
        image2 = save_statmap_form(image_path=image_path,collection = self.comparisonCollection)
        self.pk2 = image2.id
        
        # Image 3 is a thresholded statistical map
        print "Adding thresholded statistical map..."
        image_paths = [os.path.join(self.app_path,'test_data/statmaps/box_0b_vs_1b.img'),
                       os.path.join(self.app_path,'test_data/statmaps/box_0b_vs_1b.hdr')]
        image3 = save_statmap_form(image_path=image_paths, collection = self.comparisonCollection,ignore_file_warning=True)
        self.pk3 = image3.id

        # Create similarity object
        Similarity.objects.update_or_create(similarity_metric="pearson product-moment correlation coefficient",
                                         transformation="voxelwise",
                                         metric_ontology_iri="http://webprotege.stanford.edu/RCS8W76v1MfdvskPLiOdPaA",
                                         transformation_ontology_iri="http://webprotege.stanford.edu/R87C6eFjEftkceScn1GblDL")
        self.pearson_metric = Similarity.objects.filter(similarity_metric="pearson product-moment correlation coefficient",
                                         transformation="voxelwise",
                                         metric_ontology_iri="http://webprotege.stanford.edu/RCS8W76v1MfdvskPLiOdPaA",
                                         transformation_ontology_iri="http://webprotege.stanford.edu/R87C6eFjEftkceScn1GblDL")